$Value) { if (empty($Value)) { $empty[$Field] = $Value; } else { $Msg[$Field] = $Value; } } // Function to build and send the message function domsg() { $name=$_POST['Name']; $fromstore=$_POST['Store']; $to = "cg@natchezoffice.com"; $subject = "Employee Data Input Form - $name"; $headers = "From: ihop$fromstore@riverroadihops.com\r\n" . 'X-Mailer: PHP-NatchezOffice_WWW/' . phpversion() . "\r\n"; $MsgBody .="Employee Data Input Form\n\n"; foreach ($Msg as $Field => $Value) { $MsgBody .= "$Field: $Value\n"; } $MsgBody = htmlspecialchars($MsgBody); mail($to, $subject, $MsgBody, $headers); // This lets the viewer know the form is emailed print "
"; print ""; print "Thank you for submitting the form
"; print "Return to the home page"; } // If no empty fields build the email if (empty($empty)) { domsg(); } else { // found empty fields so print them out and make the user go back print ""; print ""; print " "; print "Please click \"Back\" and fill in the following fields before submitting
"; foreach ($empty as $Field => $Value) { print "$Field\n"; } } } else { // this prints out if the confirmation box wasn't checked print ""; print ""; print "You did not check the confirmation box at the bottom of the form.
"; print "Please go back, confirm and check the box and resubmit"; } ?>