This is a basic setup where once a success is made, all the entrants in the database are populated into the $body of the email, row by row.
But I cannot seem to see how to place them in the $body tag. Maybe I need a \n somewhere, but I just cannot suss it out. Help please.
Code: Select all
if ($success == "yes")
{
mysql_query("UPDATE register SET paid = 'yes' WHERE sessionid = '$sessionid'");
$to = "email@site.com";
$subject = "Booking";
$headers = "From: info@site.com";
$body = " .
$result = mysql_query ("SELECT * FROM register WHERE sessionid = '$sessionid' AND paid = 'yes'");
while ($row = mysql_fetch_object($result))
{
if ($row->leaderattending == "yes") { echo "Leader attending: $row->leaderattending";
echo "
$row->title $row->firstname $row->lastname
$row->telephone
$row->mobiletelephone
$row->email
Company (if applicable): $row->company
$row->address1
$row->address2
$row->town
$row->postcode
$row->country
Special Needs (if applicable: $row->specialneeds
Where did they hear about us: $row->wheredidyouhear
$row->datebooked
$row->dateofbooking
Paid: $row->paid
-----------------
";
}
mysql_free_result($result);
. ";
mail ($to, $subject, $body, $headers);
}
echo "<script>
window.location.replace('/register_c&success=yes')
</script>";
unset($_SESSION['sessionid']);
}