|  | Posted by Jerry Stuckle on 04/01/06 17:07 
Chris H wrote:> bassically i am buiding a simple shopping cart type feature and am using
 > sessions to store the cart contents and then when teh user checks out and
 > submits the order it will email me the cart contents.. however right now im
 > having a problem with it sending the proper data.. Insead of inserting each
 > item in the cart in teh msg o fthe email it only inserts one item... Below
 > are the two main functions i am using to accomplish this...I have also tried
 > it with the return $title; within the foreach loop as well the only thing
 > that came close was when i had echo $title; within the foreach loop,
 > unfortunately all this did was upon submitting print the cart contents to
 > the screen and totally leave them out of the boday  of the email...  I hope
 > all that makes sense
 >
 > =================
 > function mail_order($name,$email,$address) {
 >         global $admin_email;
 >   $cart = mail_format_cart();
 >
 >         $subject = "DVD ORDER FOR $name";
 >
 >         $msg = "Order Details\n\n"
 >                         ."$cart\n\n"
 >                         ."-----------------------------------------------------------------\n"
 >                         ."Name: $name\n"
 >                         ."Email: $email\n\n"
 >                ."Address:\n"
 >                         ."$address\n"
 >                         ."\n\n";
 >
 >
 >        mail("$admin_email", "$subject", "$msg", "From: $email \nReply-To:
 > $email");
 >
 > }
 >
 > function mail_format_cart() {
 >
 > foreach ($_SESSION["cart"] as $key => $session_data) {
 >   list($ses_id) = $session_data;
 >   if(isset($ses_id)) {
 >   $sel_products = mysql_query("SELECT * FROM moviedb WHERE id=".$ses_id."");
 >   $item = mysql_fetch_array($sel_products);
 >   $title = $item['title'];
 >
 >   }
 >   }
 >   return $title;
 > }
 > =======================================
 >
 >
 >
 
 Since I have no idea what's in your $_SESSION variable, I have no idea what
 might be wrong with your code.
 
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
 [Back to original message] |