Hi,
I'm trying to set up email using the php Mail function. But having trouble adding a while/loop function within the actual body of the email.
I'll show you my mail code below and then break it down to what I am trying to achieve so it's easy to understand.
mail("xxx@xxx.net,", "Enquiry Service", "Someone has requested further information using the website enquiry service.
Date form submitted: $current_date
-----------------------------------------
Personal Details\n
(Personal Detials Here)
Franchise Finder\n
[B]$code here[/B] - this is where I want the extra code to go (see the code in next block of php)
(Other information here)
______________________________________________________________
Enquiry Service
www.xxxxx.net", "From: xxxx <xxxx@xxx.net>");
?>
The code I want to go where it says $code here in the above block of php is below.
while ($row = mysql_fetch_assoc($opp))
{
$id = $row['RENI'];
$company = $row['Franchisor'];
$description = $row['Description'];
$price = $row['Invest'];
for ($i = 0; $i < count($_SESSION['cart']); $i++)
{
if ($_SESSION['cart'][$i] == $id)
{
echo '$id';
}
}
}
This makes it so it loops $id and puts the results in a list so i can collect information submitted via the website and view it in a nice and easy manor.
Any ideas how to do it correctly without the code erroring?
I'v tried just adding the while statement to where it should go - but the script falls over and other times just prints out the whole while statement in the email!!!
I would really appreciate some help on this.
Thank you kindly.
Cheers