Okay My Code works, but.... If nobody enters data into a required field it sends the form and on my HTML page... the PHP reply reads "No recipient addresses found in header"
Now I know this makes sense... Something has to be in the header info but what?
Also, why is it sending the form without the required fields filled.
Here is my CODE!
<?php
$firstName=trim($_POST['firstName']);
$address=trim($_POST['address']);
$city=trim($_POST['city']);
$zip=trim($_POST['zip']);
$phone=trim($_POST['phone']);
$cphone=trim($_POST['cphone']);
$email=trim($_POST['email']);
$contact=trim($_POST['contact']);
$priority=trim($_POST['priority']);
$within=trim($_POST['within']);
$when=trim($_POST['when']);
$source=trim($_POST['source']);
$comments=trim($_POST['comments']);
//---------VALIDATION-------->
if($firstName){//----> CHECK input
}
else{
$error.="Please, go back and fill input your full name<br>\n";//----> ERROR if no input
}
if($phone){//----> CHECK input
}
else{
$error.="Please, go back and input your home phone number, with area code<br>\n";//----> ERROR if no input
}
if($email){//----> CHECK input
}
else{
$error.="Please, go back and fill in you email address<br>\n";//----> ERROR if no input
}
if($comments){//----> CHECK input
}
else{
$error.="Please, go back and fill out the direct source if N/A, please enter N/A<br>\n";//----> ERROR if no input
}
//-------->ERROR FREE??
if($error=="Please Resubmit the form and please complete the whole form."){
echo "Thank you for inquiring about our FREE ESTIMATE! A receipt of your submission will be e-mailed to you almost immediately.";
}
//----------------------------------
$mailContent="--------CONTACT--------\n"
."Full Name: ".$firstName."\n"
."Address: ".$address."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$zip."\n"
."Home Phone: ".$phone."\n"
."Mobile Phone: ".$cphone."\n"
."E-mail: ".$email."\n"
."Contact via: ".$contact."\n"
."Interested in: ".$priority."\n"
."Starting the project: ".$within."\n"
."QRG can contact me: ".$when."\n"
."How did you hear about us: ".$source."\n"
."Comments: ".$comments."\n";
//----------------------------------
$toAddress="ME@the.net";
$subject="Long Form Free Estimate";
$recipientSubject="Free Estimate Contact Form";
$receiptMessage = "Thank you ".$firstName." for inquiring about QRG's FREE ESTIMATE!\n\n\nHere is what you submitted to us:\n\n"
."--------CONTACT--------\n"
."Full Name: ".$firstName."\n"
."Address: ".$address."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$zip."\n"
."Home Phone: ".$phone."\n"
."Mobile Phone: ".$cphone."\n"
."E-mail: ".$email."\n"
."Contact via: ".$contact."\n"
."Interested in: ".$priority."\n"
."Starting the project: ".$within."\n"
."QRG can contact me: ".$when."\n"
."How did you hear about us: ".$source."\n"
."Comments: ".$comments."\n";
//----------------------------------
mail($email, $subject, $receiptMessage,"From:$toAddress");
//----------------------------------
mail($toAddress,$recipientSubject,$mailContent,"From:$email");
//--->echo $mailContent;
?>
Thanks