Here is the (current) code of the hidden field
- Code: Select all
<p class="style5">Type of Alleged Occurrence:<input name="occurrence" type="hidden" value="<?php print 'Type of Occurrence' ?>"></p>
Here is the PHP for the array and email body
- Code: Select all
<?php
$problems = array();
$showform = 0;
$errorMessage = "";
function validate($field, $value) {
// || $field == "id" || $field == "phone" || $field == "course" || $field == "instructor"
/*if ($field == "name" || $field == "email" || $field == "computers" || $field == "info") {*/
if ($value == "") {
return 0;
} else {
return 1;
}
/*}*/
/*if ($field == "system" || $field == "browser" || $field == "issue" || $field == "multiple") {
if ($value == "----" || $value == "") {
return 0;
} else {
return 1;
}
}*/
}
if($_POST) {
//'id','phone','course','instructor',
$fields = array('name','title', 'month','day','year', 'time', 'building', 'room', 'location', 'person', 'title1', 'phone1', 'explanation', 'security', 'police', 'witness', 'acttaken', 'followact');
$x = 0 - 1;
foreach($fields as $field) {
if(isset($_POST[$field])) {
$validation = validate($field, $_POST[$field]);
if ($validation == 1) {
$x++;
$info[$x] = $_POST[$field];
} else {
$problems[$field] = 1;
$showform = 1;
}
} else {
$problems[$field] = 1;
$showform = 1;
}
}
} else {
$showform = 1;
}
if(count($problems) < 1 && $_POST) {
// DO THE MAILING HERE
$fields = array('title', 'name','month','day','year', 'time', 'building', 'room', 'location', 'title1','person', 'phone1', 'title2', 'person2', 'phone2','title3','person3', 'phone3','title4','person4', 'phone4','occurrence','obscene','altercation1', 'altercation2', 'sexharass', 'property', 'harm', 'explanation', 'security', 'police', 'witness','wtitle1', 'wperson', 'wphone1', 'wtitle2', 'wperson2', 'wphone2','wtitle3','wperson3', 'wphone3', 'acttaken', 'followact');
//$to = "mhoover@dacc.edu";
$to2 = "aabdelzaher@dacc.edu";
$to3 ="ampeck@earthlink.net";
$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>";
$body = $greet ;
$cn = 1;
foreach($fields as $efield) {
if(isset($_POST[$efield])) {
if($efield == "type3" || $efield == "type4" || $efield == "type5" || $efield == "type6" || $efield == "type7" || $efield == "type8" || $efield == "type9" ) {
$body.= "<strong>". "Type of Occurrence:". "</strong> " . $_POST[$efield] . "<p>";
$cn++;
} elseif($efield == "occurrence") {
$body.= " test <P>";
} elseif($efield == "obscene") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>" . $_POST[$efield] . " <P>";
} elseif($efield == "altercation1") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>" ."<em>". " Altercation: "."</em>" . $_POST[$efield] . " - ";
} elseif($efield == "altercation2") {
$body.= "<strong>". " "."</strong>" . $_POST[$efield] . " <p> ";
} elseif($efield == "sexharass") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>" ."<em>". " Sexual Harrasment: "."</em>" . $_POST[$efield] . " <p>";
} elseif($efield == "property") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>" ."<em>". "Damage to Property: "."</em>" . $_POST[$efield] . " <p> ";
} elseif($efield == "harm") {
$body.= "<strong>". " Type of Occurrence: "."</strong><p>" ."<em>". " Threat of Harm to Self or Others: "."</em>" . $_POST[$efield] ." <p> ";
} elseif($efield == "title") {
$body.= "<strong>"."Name of Person Filing Report: " ."</strong>" . $_POST[$efield] . " ";
} elseif($efield == "name") {
$body.= " " . $_POST[$efield] . "<p><hr color=' #33cc66'>";
} elseif($efield == "month") {
$body.= "<strong>". "Date of Occurrence : "."</strong>" . $_POST[$efield] . " ";
} elseif($efield == "day") {
$body.= "<strong>". " "."</strong>" . $_POST[$efield] . ", ";
} elseif($efield == "year") {
$body.= "<strong>". " "."</strong>" . $_POST[$efield] . " ";
} elseif ($efield == "time") {
$body.= "<strong>"."Time: " ."</strong>". $_POST[$efield] . "</p>";
} elseif ($efield == "building") {
$body.= "<strong>"."Building: ". "</strong>" . $_POST[$efield] . " ";
} elseif ($efield == "room") {
$body.= "<strong>"."Room: "."</strong>" . $_POST[$efield] . "<p>";
} elseif ($efield == "location") {
$body.= "<strong>"."Description of Location: ". "</strong>" . $_POST[$efield] . "<p> <hr color=' #33cc66'>";
} elseif ($efield == "title1") {
$body.= "<strong>"."First Person involved: ". "</strong>" . $_POST[$efield] . " ";
} elseif ($efield == "person") {
$body.= " " . $_POST[$efield] . "<p>";
} elseif ($efield == "phone1") {
$body.= "<strong>". "Phone : ". "</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif($efield == "title2" && $_POST[$efield] != '') {
$body.= "<strong>"."Second Person involved: ". "</strong>" . $_POST[$efield] . " ";
} elseif($efield == "person2" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p> ";
} elseif($efield == "phone2" && $_POST[$efield] != '') {
$body.= "<strong>". "Phone : ". "</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif($efield == "title3" && $_POST[$efield] != '') {
$body.="<strong>". "Third Person involved: ". "</strong>" . $_POST[$efield] . " ";
} elseif($efield == "person3" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p>";
} elseif($efield == "phone3" && $_POST[$efield] != '') {
$body.= "<strong>"."Phone: "."</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif($efield == "title4" && $_POST[$efield] != '') {
$body.="<strong>". "Fourth Person Involved: ". "</strong>" . $_POST[$efield] . " ";
} elseif($efield == "person4" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p>";
} elseif($efield == "phone4" && $_POST[$efield] != '') {
$body.= "<strong>"."Phone: ". "</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif ($efield == "explanation") {
$body.= "<strong>"."Detailed Explanation: ". "</strong>" . $_POST[$efield] . "<p><hr color=' #33cc66'>";
} elseif ($efield == "security") {
$body.= "<strong>"."Security called: ". "</strong>" . $_POST[$efield] . "<p>";
} elseif ($efield == "police") {
$body.= "<strong>"."Police called: "."</strong>" . $_POST[$efield] . "<p>";
} elseif ($efield == "witness") {
$body.= "<strong>"."Were there witnesses: "."</strong>" . $_POST[$efield] . "<p><hr color=' #33cc66'>";
} elseif($efield == "wtitle1" && $_POST[$efield] != '') {
$body.= "<strong>"."Witness: "."</strong>" . $_POST[$efield] . " ";
} elseif($efield == "wperson" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p>";
} elseif($efield == "wphone1" && $_POST[$efield] != '') {
$body.= "<strong>"."Phone : "."</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
}elseif($efield == "wtitle2" && $_POST[$efield] != '') {
$body.= "<strong>"."Second witness: ". "</strong>" . $_POST[$efield] . " ";
} elseif($efield == "wperson2" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p>";
} elseif($efield == "wphone2" && $_POST[$efield] != '') {
$body.= "<strong>"."Phone : ". "</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif($efield == "wtitle3" && $_POST[$efield] != '') {
$body.="<strong>". "Third witness: ". "</strong>" . $_POST[$efield] . " ";
} elseif($efield == "wperson3" && $_POST[$efield] != '') {
$body.= " " . $_POST[$efield] . "<p>";
} elseif($efield == "wphone3" && $_POST[$efield] != '') {
$body.= "<strong>". "Phone: "."</strong>" . $_POST[$efield] . "<p><hr color=' # 33cc66'>";
} elseif ($efield == "acttaken") {
$body.= "<strong>"."Immediate Action Taken: " ."</strong>". $_POST[$efield] . "<p><hr color=' #33cc66'>";
} elseif ($efield == "followact") {
$body.= "<strong>". "What Follow-up Action will be taken: " ."</strong>". $_POST[$efield] . "<p><hr color=' #33cc66'>";
}
}
}
//mail($to, $subject, $body, $headers);
mail($to2, $subject, $body, $headers);
mail($to3, $subject, $body, $headers);
?>
<p class="style1">Your report has been submitted.<br><br></p>
<?php
}
if($showform == 1) {
?>

