ok this is all helpful for firephp but there is a bigger issue that might be related. There is no MySQl server. The handler page just needs to send the form posted email , they want it $POSTed not a $GET, so the form data isn't sent in the open air. So do I need to use a cookie instead of a $_POST? Maybe this is why my code keeps getting a die error. So this code below is the handler page in the <form method="POST" action="handler.php">
form tags. How can I make it work with a POST without a database? Sorry I just realized what could be the problem. Firephp might not be finding a problem but the error messages make it look like it wasn't posted.
This is the code
<?php
if(isset($_POST['email'])) {
//
$email_to = "janis.rough@gmail.com";
$email_subject = "Distributor_Inquiry";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br /> ";
echo "Please go back and fix these errors.<br /><br />";
}
// validation expected data exists
if(!isset($_POST['first']) ||
!isset($_POST['last']) ||
!isset($_POST['company']) ||
!isset($_POST['email'])){
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first']; // required
$last_name = $_POST['last']; // required
$company = $_POST['company']; // required
$address = $_POST['address']; // not required
$address2 = $_POST['address2']; //not required
$city = $_POST['city']; //not required
$state = $_POST['state']; //not required
$zip = $_POST['zip']; //not required
$email_from = $_POST['email']; // required
$telephone = $_POST['phone']; // not required
$url = $_POST['url']; //not required
$comments = $_POST['message']; //not 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)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}*/
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Company: ".clean_string($company)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $company, $headers);
?>
<!-- include your own success html here -->
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>
This is the die error message.
We are very sorry, but there were error(s) found with the form you submitted. These errors appear below.
We are sorry, but there appears to be a problem with the form you submitted.
Please go back and fix these errors.
Thank you for contacting us. We will be in touch with you very soon.