Alternatively you can just name all of the check boxes the same and add [] at the end.
For instance set the "name" of each checkbox to "hours_available[]"
And then in the script do something like
Code:
<?PHP
$mailto = "seniorhelpers******.com";
$hours_available = $HTTP_POST_VARS['hours_available'];
$email = $HTTP_POST_VARS['email'];
if ($email == "") {
$email = $mailto;
}
$mailsubj = "Caregiver Employment Submission Form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "first, Last, phone_number, second_number, city, state, zip,how_hear_about_us, years_experience,cna,hha,companion,hours_available ,full_time, part_time,day_shift,Night_shift, weekends,live_in,flexible,have_car,email,drives,co mments:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
$mailbody .= "Hours Available \n";
for($i=0; $i < count($hours_available); $i++)
{
$mailbody .= $hours_available[$i]."\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?> And then just set the values for each checkbox to the label you want to display in the email.. so set the values of each checkbox to "Full Time", "Part Time", "Day Shift", etc.
The only disadvantage to doing it this way is that since the rest of the email is being generated and the format isn't hard coded in, doing is this way all the check boxes have to go before or after the the rest of the email body.
Andy's way hard codes the email message, so its in the same order as the form.