A
Anonymous
Guest
Hi. I am having this problem using the email function. I get a cookie and use the value of it to get an array like below: The problem is that when I email the variable, only the last line of the array is sent, not the whole thing. But, everything gets printed on the screen like it should. Can someone help me here?
for ($y = 0; $y < 15; $y++) {
$realy=$y+1;
$tempAns= $answers[y];
$tempCorrect= $CorrectAns[y];
//if (strtolower($tempAns)==strtolower($tempCorrect)) {
echo "$speechst Question $realy - Correct.";
//}
//else {
echo "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$ans = "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
//}
}
//$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
$hdr = "From: Infotrends Canada\r\n";
$hdr .= "Return-Path: $someone@somewhere.com\r\n";
if($cc){$hdr .= "Cc: $cc\r\n";}
if($bcc){$hdr .= "Bcc: $bcc\r\n";}
for($i = 0; $i < $sizeof; $i++){
if(mail($to[$i], $subject, $body, $hdr))
{
$status = "Your message was successfully sent.";
}
else
{
$status = "An error occurred while sending your message.";
}
}

for ($y = 0; $y < 15; $y++) {
$realy=$y+1;
$tempAns= $answers[y];
$tempCorrect= $CorrectAns[y];
//if (strtolower($tempAns)==strtolower($tempCorrect)) {
echo "$speechst Question $realy - Correct.";
//}
//else {
echo "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$ans = "$speechst Question $realy - Incorrect. Actual Answer was :$Explanation[y]";
$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
//}
}
//$body = "$email, $name, $Company, $City, $phone_no, $currentgrade, $currentScore, $ans";
$hdr = "From: Infotrends Canada\r\n";
$hdr .= "Return-Path: $someone@somewhere.com\r\n";
if($cc){$hdr .= "Cc: $cc\r\n";}
if($bcc){$hdr .= "Bcc: $bcc\r\n";}
for($i = 0; $i < $sizeof; $i++){
if(mail($to[$i], $subject, $body, $hdr))
{
$status = "Your message was successfully sent.";
}
else
{
$status = "An error occurred while sending your message.";
}
}