|
Posted by pmAgony on 10/12/30 11:38
Not working:
<?php
$today = date("l F d, Y");
$valid_data = true; // we assume data is good until we find something
bad
if (!($_POST['email'] || $_POST['phone'])) {
$valid_data = false;
$error_message .= "Please ensure required fields denoted with
asterisks (*) are filled out.";
}
if ($_POST['email']) {
if (! (ereg("^[a-zA-Z0-9_.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",
$_POST['email']) )) {
$valid_data = false;
$error_message .= "Please ensure that your email address is in a valid
format: e.g., alias@yourdomain.com";
}
}
if ($valid_data == false) {
header("Location: contact.php?name=" . $_POST['name'] . "&company=" .
$_POST['cname'] . $_POST['phone'] . "&email=" . $_POST['email'] .
$_POST['comment'] . "&error_message=" . $_POST['error_message'] .
"&who=" . $_POST['who']);
exit();
}
switch($_POST['who']) {
case 1: $sendto = "xxx@zzz.com"; break;
case 2: $sendto = "xxx@zzz.com"; break;
case 3: $sendto = "xxx@zzz.com"; break;
case 4: $sendto = "xxx@zzz.com"; break;
}
$msg = "Someone has contacted you through your website. Their contact
information is included below.\n\n" . "\n<b>Support Type</b>: " .
$_POST['who'] . "\nName: " . $_POST['name'] . "\nCompany: " .
$_POST['cname'] . "\nPhone: " . $_POST['phone'] . "\nEmail: " .
$_POST['email'] . "\nComment: " . $_POST['comment'];
$msg2 = "Thank you for contacting HCEDesigns.com. We will review your
submission and respond shortly.\n\n Visit us on the web!
www.hcedesigns.com";
$headers = "From: \"HCE Designs\" <xx@zzz.com>\nReply-To:
<xx@zzz.com>\n";
mail($sendto, "FORM RESULTS; HCEDesigns.com", $msg, $headers);
if ($_POST['email']) {
$auto_response = $_POST['email'];
mail($auto_response, "Thank you for contacting HCEDesigns.com", $msg2,
$headers);
}
?>
Navigation:
[Reply to this message]
|