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($nam e,$email,$addre ss) {
global $admin_email;
$cart = mail_format_car t();
$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_em ail", "$subject", "$msg", "From: $email \nReply-To:
$email");
}
function mail_format_car t() {
foreach ($_SESSION["cart"] as $key => $session_data) {
list($ses_id) = $session_data;
if(isset($ses_i d)) {
$sel_products = mysql_query("SE LECT * FROM moviedb WHERE id=".$ses_id."" );
$item = mysql_fetch_arr ay($sel_product s);
$title = $item['title'];
}
}
return $title;
}
=============== =============== =========