Jump to content

Having problems coding a form from email submission


hypgraphix

Recommended Posts

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!!

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.