Hi there everyone,
I'm sending an email containing all the products ordered and am having a problem trying to figure out how to include the products ordered into the email.
Currently, I've got the following.
/*Necessary data from the order form*/
$order_email=$_POST['order_email'];
$shipping_address=nl2br($_POST['address']);
/*Get the admin email addresses.*/
$query="SELECT email FROM admin WHERE notify_of_order='1'";
$result=mysql_query($query) or die (mysql_error());
$numr=mysql_num_rows($result);
if($numr!=0){
while($row=mysql_fetch_array($result)){
$email=$row['email'];
$to .= $email . ", ";
}
}
/*Get the information for the products ordered.*/
$query="SELECT * FROM orders_items WHERE order_id=$order_id";
$result=mysql_query($query) or die (mysql_error());
$numr=mysql_num_rows($result);
if($numr!=0){
while($row=mysql_fetch_array($result)){
$title=$row['title'];
$quantity=$row['quantity'];
echo("
<tr>
<td width='400'>
".$title."
</td>
<td width='200'>
".$quantity."
</td>
</tr>
");
}
}
$to .= $order_email;
$subject = "PhoenixHill Order";
$message = "
<html>
<head>
<title>PhoenixHill Order</title>
</head>
<body>
<b>Ship To:<br />
<br />
".$shipping_address."<br />
<br />
<table width='600' border='1' cellpadding='1' cellspacing='1'>
<!--I need my products ordered content here-->
</table>
</body>
</html>
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: noreply@phoenixhill.net" . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
Could someone help me with how to get the content from the product ordered sql query into the proper part of the following $message?
Thanks in advance for your time!