You are here: Please, need help with a mail function « PHP Programming Language « IT news, forums, messages
Please, need help with a mail function

Posted by Chris H on 04/01/06 09:40

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;
}
=======================================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация