php - Contact Form Fields not being sent -
the project , phone fields in contact form script arent working. ideas i'm doing wrong every other field works great:
<? php include('contact-config.php'); $contact_form_version = strtolower($contact_form_version); if (empty($to) || empty($contact_form_version) || ($contact_form_version != 'php' && $contact_form_version != 'html')) { die('error: contact form has not been setup correctly.'); } else { if ($contact_form_version == 'php') { $formlocation = 'contact.php'; } else if ($contact_form_version == 'html') { $formlocation = 'contact.html'; } } if (!empty($_post['isajax']) && $_post['isajax'] == '1') { $ajax = true; } else { $ajax = false; } if (empty($_post['name']) || empty($_post['project']) || empty($_post['email']) || empty($_post['phone']) || empty($_post['message'])) { if ($ajax || $contact_form_version == 'html') { die('error: missing variables'); } else { header("location: $formlocation?msg=missing-variables"); exit; } } if (!preg_match("/^([a-za-z0-9_\-\.])+\@([a-za-z0-9_\-\.])+\.([a-za-z]{2,8})$/", $_post['email'])) { if ($ajax || $contact_form_version == 'html') { die('error: invalid email address'); } else { header("location: $formlocation?msg=invalid-email-address"); exit; } } $name = $_post['name']; $project = $_post['project']; $email = $_post['email']; $phone = $_post['phone']; $message = $_post['message']; $code = $_post['captcha']; $eip = $_post['eip']; $to = $to; $headers = 'from: '.$name.' <'.$email.'>'." \r\n"; $headers. = 'reply-to: '.$email."\r\n"; if (isset($cc) && $cc != '') { $headers. = 'cc: '.$cc."\r\n"; } if (isset($bcc) && $bcc != '') { $headers. = 'bcc: '.$bcc."\r\n"; } $headers. = 'x-mailer: php/'.phpversion(); $subject = 'contact form enquiry'; $message = wordwrap($message, 70); if (mail($to, $subject, $message, $headers)) { if ($ajax || $contact_form_version == 'html') { die('mail sent'); } else { header("location: $formlocation?msg=mail-sent"); exit; } } else { if ($ajax || $contact_form_version == 'html') { die('error: mail failed'); } else { header("location: $formlocation?msg=mail-failed"); exit; } } ?>
any hugely appreciated guys.
thanks bunch
your not sending details try.
$name = $_post['name']; $project = $_post['project']; $email = $_post['email']; $phone = $_post['phone']; $message = $_post['message']; $code = $_post['captcha']; $eip = $_post['eip']; $content = $name . ' ' . $project . ' ' . $email . ' ' . $phone . ' ' . $message . ' ' . $code . ' ' . $eip; if (mail($to, $subject, $content, $headers)) {
Comments
Post a Comment