\n
These fields are required:
\n
\n
\n”;
//check for name
if (empty($_POST[‘name’])) {
$problem = TRUE;
$errStr .= “
\n”;
} else {
$name = htmlentities(stripslashes(trim($_POST[‘name’])));
}
//check for email
if (empty($_POST[’email’])) {
$problem = TRUE;
$errStr .= “
\n”;
} else {
$email = htmlentities(stripslashes(trim($_POST[’email’])));
}
//check for subject
if (empty($_POST[‘subject’])) {
$problem = TRUE;
$errStr .= “
\n”;
} else {
$subject = htmlentities(stripslashes(trim($_POST[‘subject’])));
}
//check for body
if (empty($_POST[‘body’])) {
$problem = TRUE;
$errStr .= “
\n”;
} else {
$body = htmlentities(stripslashes(trim($_POST[‘body’])));
}
//check for honeypot
if ($_POST[‘honeypot’] == 1) {
$problem = TRUE;
$errStr .= “
\n”;
}
if ($problem) {
print “$startErr $errStr $endErr”;
} else { //process form
$displayForm = FALSE;
//send email
$to = ‘prasad.k@imzmediasolutions.com’ . ‘, ‘; // note the comma
$to .= ”;
$headers = ‘From: prasad.k@imzmediasolutions.com’ . “\r\n” .
‘Reply-To: ‘ . $email . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
$message = ‘From: ‘ . $name . “\r\n\n” .
‘Email: ‘ . $email . “\r\n\n” .
$body . “\r\n”;
mail($to, $subject, $message, $headers);
if (isset($_POST[‘copy’])) {
$to = $email . ‘, ‘; // note the comma
$to .= ”;
$headers = ‘From: email@example.com’ . “\r\n” .
‘Reply-To: noreply@example.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
$message = $body . “\r\n”;
mail($to, ‘Copy of your message to Your Name: ‘ . $subject, $body, $headers);
}
print “
Your message was sent successfully!
“;
}
}
if ($displayForm) {
?>