Hi I want to send loop data with php mail function here is my code:
foreach ($data['query'] as $row){
echo $row->name;
echo "<br>";
echo $row->time;
echo "<br>";
echo $row->dosage;
echo "<br>";
echo $row->frequency;
echo "<br>";
echo $row->quantity;
echo "<br>";
}
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com";
mail($to,$subject,$txt,$headers);
Can anybody told me how I can attach foreach loop data to email message body, I mean instead of sending this text (Hello World!) in body I want to send loop data.