This is the code for the display_checkout_cart function:
function display_checkout_cart($cart, $change=true, $images = 1){
//display items in shopping cart
//optionally allow changes (true or false)
//optionally include images
global $_SESSION;
echo("
<table width='750' border='0' cellspacing='0' cellpadding='0'>
<form action='/project/checkout.php' method='post'>
<tr>
<td width='368'><p><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b>Product Name</b></font></p>
<p> </p></td>
<td width='138'><p><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b>Price</b></font></p>
<p> </p></td>
<td width='194'><p><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b>Qty</b></font></p>
<p> </p></td>
<td width='50'><p><font size='1' face='Verdana, Arial, Helvetica, sans-serif'><b>Total</b></font></p>
<p> </p></td>
</tr>
");
//display each item as a table row
foreach($cart as $prod['productID'] => $qty){
$prodInfo = mysql_fetch_array(mysql_query("select productPrice, productName from products where productID = ".$prod['productID'].""));
echo ("
<tr>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>".$prodInfo['productName']."</font></td>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>\$".number_format($prodInfo['productPrice'], 2)."</font></td>
<td>");
//if we allow changes, quantities are in text boxes
if($change==true){
echo("
<font size='1' face='Verdana, Arial, Helvetica, sans-serif'><input type='text' name='".$prod['productID']."' size='2' value='".$qty."'>add/remove</font></td>
");
}else{
echo(" <font size='1' face='Verdana, Arial, Helvetica, sans-serif'>$qty</font> ");
}
echo("
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>\$".number_format($prodInfo['productPrice'] * $qty, 2)."</font></td>
</tr>
");
}
echo("
<tr>
<td colspan='4'><hr width='750' noshade><br></td>
</tr>
");
//display total row
echo("
<tr>
<td width='368'><p> </p></td>
<td width='138'><p> </p></td>
<td width='194'><b><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>".$_SESSION['items']."</font></b></td>
<td width='50'><b><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>\$".number_format($_SESSION['total_price'],2)."</font></b></td>
</tr>
</form></table>");
}
I hope this helps.
And yes, when I call the function within the body of the email like this:
$useremail="$email, webmaster@mysite.com";
$subject="Order Details";
$header = "From: order@xyzcompany.com\r\n";
$header .= "X=Mailer: PHP/";
$body="Here are the details of your order:
Contact Information:
$firstName $lastName
$address $apt
$city, $state $zip
$country
$phone
Billing and Shipping Information:
$bfirstName $blastName
$baddress $bapt
$bcity, $bstate $bzip
$bcountry
".display_checkout_cart($cart)."
Number of Items Ordered: ".$_SESSION['items']."
Order Total: \$".number_format($_SESSION['total_price'],2)."
";
mail ($useremail, $subject, $body, $header);
It just echoes it in the browser but doesn't add it to the email.
Thanks