contact form issues

hello everyone

I’m a web designer, but don’t do php coding. My client wants a contact form on her site. I grabbed some code that was written by someone else and plugged in my info, but when i fill out the form the thank you page doesn’t come up and my client doesn’t recieve email with the info from the from. I would really appreciate it if someone would be willing to look at my code and tell me what is wronf with it. Thank you very much in advance. If I can ever return the favor with some graphic/illustration work, please let me know.

here is the php code:

<?php $email_to = “[email protected]”; // your email address $email_subject = "Feedback Form Message"; // email subject line $thankyou = "thank_you.html”; // thank you page if(isset($_POST['Email'])) { include 'feedbackformsettings.php'; function died($error) { echo "Sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.

"; echo $error."

"; echo "Please go back and fix these errors.

"; die(); } if(!isset($_POST['Name']) || !isset($_POST['Email']) || !isset($_POST['Subject']) || !isset($_POST['Message']) || !isset($_POST['AntiSpam']) ) { died('Sorry, there appears to be a problem with your form submission.'); } $full_name = $_POST['Name']; // required $email_from = $_POST['Email']; // required $subject = $_POST['Subject']; // required $comments = $_POST['Message']; // required $antispam = $_POST['AntiSpam']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(preg_match($email_exp,$email_from)==0) { $error_message .= 'The Email Address you entered does not appear to be valid.
'; } if(strlen($full_name) < 2) { $error_message .= 'Your Name does not appear to be valid.
'; } if(strlen($comments) < 2) { $error_message .= 'The Message you entered do not appear to be valid.
'; } if($antispam <> $antispam_answer) { $error_message .= 'The Anti-Spam answer you entered is not correct.
'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\r\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($full_name)."\r\n"; $email_message .= "Email: ".clean_string($email_from)."\r\n"; $email_message .= "Subject: ".clean_string($subject)."\r\n"; $email_message .= "Message: ".clean_string($comments)."\r\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($email_to, $email_subject." - $subject", $email_message, $headers); header("Location: $thankyou"); ?> <?php } die(); ?>

Looks like an error here,

[php] if(strlen($error_message) > 0) {
died($error_message);
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service