I am having problems getting the cc email to work. Can you look at the code and see what I am doing wrong.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Your Order</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="includes/form.css" type="text/css">
</head>
<body>
<h1>Your Order</h1>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<th class="first">Product</th>
<th>Quantity</th>
<th>Totals</th>
</tr>
<?php
/* Specify your SMTP Server, Port and Valid From Address */
ini_set("SMTP","mail.domai
n.com");
ini_set("smtp_port","25");
ini_set("sendmail_from","e
mail@domai
n.com");
// put the email address you wish the order to be sent to here
$to_address = "toemail@domain.com";
$cc_address = "ccemail@domain.com";
$subject = "Order Submitted";
// no need for changes to code below this line
$from = "From: " . $_POST['email'];
$msg = "Order submitted by " . $_POST['email'] . "\n\n";
while ( list($name, $value) = each($_POST) ) {
$pt = strrpos($name, "_");
$suf = substr($name, $pt+1);
if ( $suf == "qty" && !empty($value) ) {
$product = substr($name, 0, $pt);
echo '
<tr>
<td>' . $_POST[$product . "_title"] . '</td>
<td class="qty">' . $_POST[$product . "_qty"] . '</td>
<td class="cur">$' . $_POST[$product . "_tot"] . '</td>
</tr>';
$msg .= $_POST[$product . "_qty"] . " of " . $_POST[$product . "_title"] . " for $ " . $_POST[$product . "_tot"] . "\n";
}
}
// if shipping or sales tax, display sub-total
if ( $_POST['ship_amt'] > 0 || $_POST['tax_amt'] > 0 ) {
echo '
<tr>
<td colspan="2" class="lbl">Sub Total: </td>
<td class="cur">$' . $_POST['sub_tot'] . '</td>
</tr>';
$msg .= "\nSub Total: $" . $_POST['sub_tot'] . "\n";
}
// shipping?
if ( $_POST['ship_amt'] > 0 ) {
echo '
<tr>
<td colspan="2" class="lbl">Shipping: </td>
<td class="cur">$' . $_POST['ship_amt'] . '</td>
</tr>';
$msg .= "Shipping: $" . $_POST['ship_amt'] . "\n";
}
// sales tax?
if ( $_POST['tax_amt'] > 0 ) {
echo '
<tr>
<td colspan="2" class="lbl">Sales Tax: </td>
<td class="cur">$' . $_POST['tax_amt'] . '</td>
</tr>';
$msg .= "Sales Tax: $" . $_POST['tax_amt'] . "\n";
}
// total
echo '
<tr>
<td colspan="2" class="gtot">Total: </td>
<td class="gtot">$' . $_POST['grand_tot'] . '</td>
</tr>';
$msg .= "-------------------------
----------
------\n";
$msg .= "Grand Total: $" . $_POST['grand_tot'];
mail($to_address,$cc_addre
ss, $subject, $msg, $from);
?>
</table>
<p>Thank you for your order.</p>
</body>
</html>
Start Free Trial