Here is an example of an email for the college section which is the checkbox section:
Colleges Seclected:
Checked: Baltimore City Community College
Checked: The Community College of Baltimore County
Checked: Baltimore City Community College
Checked: The Community College of Baltimore County
Here is the code:
<?php
if(isset($_POST['submit'])) {
$to = "hkhalid@howardcc.edu";
$subject = "Request Form";
$coursename_field = $_POST['coursename'];
$dates_field = $_POST['dates'];
$times_field = $_POST['times'];
$level_field = $_POST['level'];
$comments_field = $_POST['comments'];
$name_field = $_POST['name'];
$title_field = $_POST['title'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$company_field = $_POST['company'];
foreach($_POST['collegelist'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body =
"
Course Date: $coursename
Dates: $dates
Times: $times
Level of Training Desired: $level
Colleges Seclected:
$check_msg
Other Comments: $comments
Submitted By
Name: $name
Title: $title
Email: $email
Phone: $phone
Company: $company
";
header('Location: [url]http://www.marylandtraining.com/sent.htm[/url]');
mail($to, $subject, $body);
} else {
echo "error!";
}
?>
here is this html checkbox form area if it matters:
<br>
<font color="#d62852"><b>Please select which community college(s) you would like to receive information from:</b></font><br>
<table width="100%">
<tbody><tr>
<td><input name="collegelist[]" value="Allegany Community College" type="checkbox">Allegany</td>
<td><input name="collegelist[]" value="Frederick Community College" type="checkbox">Frederick</td>
</tr>
<tr>
<td><input name="collegelist[]" value="Anne Arundel Community College" type="checkbox">Anne Arundel</td>
<td><input name="collegelist[]" value="Garrett Community College" type="checkbox">Garrett</td>
</tr>
<tr>
<td><input name="collegelist[]" value="Baltimore City Community College" type="checkbox">Baltimore City</td>
<td><input name="collegelist[]" value="Hagerstown Community College" type="checkbox">Hagerstown</td>
</tr>
<tr>
<td><input name="collegelist[]" value="The Community College of Baltimore County" type="checkbox">Baltimore County</td>
<td><input name="collegelist[]" value="Harford Community College" type="checkbox">Harford</td>
</tr>
<tr>
<td><input name="collegelist[]" value="Carroll Community College" type="checkbox">Carroll</td>
<td><input name="collegelist[]" value="Howard Community College" type="checkbox">Howard</td>
</tr>
<tr>
<td><input name="collegelist[]" value="Cecil Community College" type="checkbox">Cecil</td>
<td><input name="collegelist[]" value="Montgomery College" type="checkbox">Montgomery</td>
</tr>
<tr>
<td><input name="collegelist[]" value="Chesapeake College" type="checkbox">Chesapeake</td>
<td><input name="collegelist[]" value="Prince George's Community College" type="checkbox">Prince George's</td>
</tr>
<tr>
<td><input name="collegelist[]" value="College of Southern Maryland" type="checkbox">Southern Maryland</td>
<td><input name="collegelist[]" value="Wor-Wic Community College" type="checkbox">Wor-Wic</td>
</tr>
</tbody></table>