hypgraphix Posted April 16, 2007 Share Posted April 16, 2007 I am totally new to php and coding. I have a customer who wants his contact page customized to be a form with questions to be answered by the person trying to contact him. When they are done filling in the form it is suppose to be emailed to him. I can not get this form to work right. This is the basic info he wants: Company Name Contact Name What do you wish to achieve with our products? (he wants to be able to select these with check boxes in front of the text) Lower maintenance cost lower energy costs increased equipment lifespan improved indoor air quality reduced liabilities. Do you currently use these types of systems? Are you currently having any issues with mold and mildew? Phone Fax Email Comments, suggestions or questions This is the coding I have set up now: <? $companyname = $_POST['CompanyName0']; $companycontact = $_POST['CompanyContact0']; $what = $_POST['What0']; $do = $_POST['Do0']; $are = $_POST['Are0']; $phone = $_POST['Phone0']; $fax = $_POST['Fax0']; $email = $_POST['Email0']; $comments = $_POST['Comments0']; $to = "[email protected]"; $message = "CompanyName = $companyname\n"; $message .= "CompanyContact = $companycontact\n"; $message .= "What = $what\n"; $message .= "Do = $do\n"; $message .= "Are = $are\n"; $message .= "Phone = $phone\n"; $message .= "Fax = $fax\n"; $message .= "Email = $email\n"; $message .= "Comments = $comments\n"; if(mail($to,"Form Results",$message,"From: $email\n")) { echo "Thanks for your comments."; } else { echo "There was a problem sending the mail. Please check that you filled in the form correctly."; } ?> Please help me!! I am so retarded with this stuff. Thanks so much!! Link to comment https://forums.phpfreaks.com/topic/47269-having-problems-coding-a-form-from-email-submission/ Share on other sites More sharing options...
per1os Posted April 16, 2007 Share Posted April 16, 2007 Mail statements are generally not reliable for if statements, as they can return false even if they are sent. www.php.net/mail Look into the Mail() function noteably at the examples, you want the Header information and look at the -f portion. That will help your email to be "properly" formed and sent out. Link to comment https://forums.phpfreaks.com/topic/47269-having-problems-coding-a-form-from-email-submission/#findComment-230558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.