OK I have an incident report form that has some check boxes on it. I tried using the implode function on the check boxes so that if more than one checkbox is checked all values will be passed to the array and emailed. I did this exactly the way I did it on a Request for accommodations form (that form works), but it does not pass all the values. I am sure I am missing something really simple but I can't find it. Any help would be appreciated.
The PHP
$fields = array('title', 'name','date', 'time', 'building', 'room', 'location', 'title1','person', 'phone1', 'title2', 'person2', 'phone2','title3','person3', 'phone3','title4','person4', 'phone4','occurrence','obscene','altercation1', 'altercation2', 'sexharass', 'property', 'harm', 'drugs', 'other', 'explanation', 'security', 'police', 'witness','wtitle1', 'wperson', 'wphone1', 'wtitle2', 'wperson2', 'wphone2','wtitle3','wperson3', 'wphone3', 'acttaken', 'followact');
//$to = "example@example.com";
$to2 = "example@example.com";
//$to3 ="example@example.com";
$subject = "Incident / Unusual Occurrence Report";
$headers ='MIME-Version: 1.0' .PHP_EOL;
$headers .='Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
$headers .= "From: noreply@dacc.edu\r\n" . "X-Mailer: php";
$greet = "The following was submitted on " . date("F j, Y, g:i a") . "<p><p>";
$sexharass = implode(', ', $_POST['sexharass']);
$altercation1 = implode(', ', $_POST['altercation1']);
$altercation2 = implode(', ', $_POST['altercation2']);
$harm = implode(', ', $_POST['harm']);
$property = implode(', ', $_POST['property']);
$drugs = implode(', ', $_POST['drugs']);
$other = implode(', ', $_POST['other']);
$body = $greet ;
$cn = 1;
foreach($fields as $efield) {
if(isset($_POST[$efield])) {
if($efield == "occurrence") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>";
} elseif($efield == "obscene") {
$body.= $_POST[$efield] . " <P>";
} elseif($efield == "altercation1") {
$body.= "<em>". " Altercation: "."</em>" . $altercation1 . " - ";
} elseif($efield == "altercation2") {
$body.= "<strong>". " "."</strong>" . $altercation2 . " <p> ";
} elseif($efield == "sexharass") {
$body.= "<em>". " Sexual Harrasment: "."</em>" . $sexharass . " <p>";
} elseif($efield == "property") {
$body.= "<em>". "Damage to Property: "."</em>" . $property . " <p> ";
} elseif($efield == "harm") {
$body.= "<em>". " Threat of Harm to Self or Others: "."</em>" . $harm ." <p> ";
} elseif($efield == "drugs") {
$body.= "<em>". " Drugs or Alcohol: "."</em>" . $drugs ." <p> ";
} elseif($efield == "other") {
$body.= "<em>". " Other types of Occurrences: "."</em>" . $other ." <p> ";
The Form
<p class="style5">Type of Alleged Occurrence:<input name="occurrence" type="hidden" value="<?php { print 'Type of Occurrence'; }?>"></p>
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<table style="width: 100%">
<tr>
<td style="width: 21%; height: 57px;"><strong> Disruption:</strong><br>
<input name="obscene" type="checkbox" value="Obscene Language" <?php if(isset($_POST['obscene'])) echo "checked"; ?>>
<label >Obscene language </label>
</td>
<td style="width: 33%; height: 57px;">
<strong> Sexual Harassment:</strong><br>
<input name="sexharass[]" type="checkbox" value="Physical" <?php if(isset($_POST['sexharass']) && in_array('Physical',$_POST['sexharass'])) { echo 'checked'; } ?>>
<label>Physical </label>
<input name="sexharass[]" type="checkbox" value="Verbal" <?php if(isset($_POST['sexharass']) && in_array('Verbal',$_POST['sexharass'])) { echo 'checked'; } ?>>
<label>Verbal </label>
</td>
</tr>
<tr>
<td style="width: 21%; height: 57px;">
<strong> Altercation:</strong><br>
<input name="altercation1[]" type="checkbox" value="Verbal" <?php if(isset($_POST['altercation1']) && in_array('Verbal',$_POST['altercation1'])) { echo 'checked'; } ?>>
<label>Verbal</label>
<input name="altercation1[]" type="checkbox" value="Physical"<?php if(isset($_POST['altercation1']) && in_array('Physical',$_POST['altercation1'])) { echo 'checked'; } ?> >
<label >Physical</label><br>
<td style="width: 33%; height: 57px;"><strong>Involved in altercation:</strong><br>
<input name="altercation2[]" type="checkbox" value="student/student" <?php if(isset($_POST['altercation2']) && in_array('student/student',$_POST['altercation2'])) { echo 'checked'; } ?>>
<label>Student/Student </label>
<input name="altercation2[]" type="checkbox" value="student/faculty-staff" <?php if(isset($_POST['altercation2']) && in_array('student/faculty-staff',$_POST['altercation2'])) { echo 'checked'; } ?>>
<label >Student/Faculty-Staff </label>
</td>
</tr>
<tr>
<td>
<strong> Theft/ Damage to Property:</strong><br>
<input name="property[]" type="checkbox" value="DACC" <?php if(isset($_POST['property']) && in_array('DACC',$_POST['property'])) { echo 'checked'; } ?> > <label >DACC </label> <span lang="en-us"> <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<input name="property[]" type="checkbox" value="Self" <?php if(isset($_POST['property']) && in_array('Self',$_POST['property'])) { echo 'checked'; } ?> > <label >Self </label>
</font> <br>
</span>
<input name="property[]" type="checkbox" value="Faculty/Staff" <?php if(isset($_POST['property']) && in_array('Faculty/Staff',$_POST['property'])) { echo 'checked'; } ?> >
<label >Faculty/Staff </label>
</td>
<td>
<strong> Threat of Harm to Self or Others:</strong><br>
<input name="harm[]" type="checkbox" value="Student/Student" <?php if(isset($_POST['harm']) && in_array('Student/Student',$_POST['harm'])) { echo 'checked'; } ?> >
<label >Student/Student </label> <span lang="en-us">
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<input name="harm[]" type="checkbox" value="Self" <?php if(isset($_POST['harm']) && in_array('Self',$_POST['harm'])) { echo 'checked'; } ?>>
<label >Self </label>
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<span lang="en-us">
<input name="harm[]" type="checkbox" value="Student/Faculty-Staff" <?php if(isset($_POST['harm']) && in_array('Student/Faculty-Staff',$_POST['harm'])) { echo 'checked'; } ?>>
<label>Student/Faculty-Staff </label>
</span></font>
</td>
</tr>
<tr>
<td>
<strong> Drugs/Alcohol:</strong><br>
<input name="drugs[]" type="checkbox" value="Under the Influence" <?php if(isset($_POST['drugs']) && in_array('Under the Influence',$_POST['drugs'])) { echo 'checked'; } ?> >
<label >Under the Influence </label>
<font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<input name="drugs[]" type="checkbox" value="Possession" <?php if(isset($_POST['drugs']) && in_array('Possession',$_POST['drugs'])) { echo 'checked'; } ?> > <label >Possession </label>
</font>
</td>
<td>
<strong> Other Occurrences:</strong><br>
<input name="other[]" type="checkbox" value="Tresspassing" <?php if(isset($_POST['other']) && in_array('Tresspassing',$_POST['other'])) { echo 'checked'; } ?> > <label >Trespassing </label> <span lang="en-us"> <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<input name="other[]" type="checkbox" value="Other" <?php if(isset($_POST['other']) && in_array('Other',$_POST['other'])) { echo 'checked'; } ?> >
<label >Other </label>
</font><br>
</span>
</td>
</tr>
</table><p></p>