okay, first thing to know is that this is an event sign-up sheet, so it has a few text fields (which work fine) and three text boxes (which are my problem). when the person hits submit on the form, it needs to send an email to my email address that has all of the information in it and ONLY the checked check boxes.
My problem is that with using foreach, the email only tells me the last text box of the three they checked. (if they checked boxes 1 and 2, only 2 will be listed, as well as if they checked all three boxes, only the third will be listed..)
here is the code for the form submission..
[code=php:0]<?php
if (getenv(HTTP_X_FORWARDED_FOR))
{
$ip = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ip = getenv(REMOTE_ADDR);
}
$adminEmail = "admin@berryrotc.com";
$subject = "Event Participation";
$Name = $_POST['Name'];
$Rank = $_POST['Rank'];
$LetLevel = $_POST['LetLevel'];
$ClassPeriod = $_POST['ClassPeriod'];
$Comments = $_POST['Comments'];
$Event = $_POST['Event'];
foreach ($Event as $Eventname)
$finalMessage = "$Rank $Name would like to participate in an upcoming event. More information below.\n\nRank: $Rank \nName: $Name \nLet Level: $LetLevel \nClass Period: $ClassPeriod \nEvents to participate in: \n $Eventname \n\n\nComments:\n$Comments";
$str = "Rank: $Rank \nName: $Name \nLetLevel: $LetLevel \nClass Period: $ClassPeriod \n$Eventname \n\n\nComments: \n$Comments";
$out = fopen("backup_contact_form.txt", "a+");
mail($adminEmail, $subject, $finalMessage);
fwrite($out, $str);
fclose($out);
echo "<font color=\"white\">Thank you for signing up for JROTC Events. Your name will be added to the roster shortly!</font>";
?>
[/code]
See anything that might be wrong? thanks in advance for any ideas or help offered.