Contact Form to E-mail Linebreaks not working
Posted: Sat Jun 27, 2009 8:49 pm
I'm trying to make a contact form that is sent using PHP to an E-mail account. I can't seem to get it to work right.
As the code stands now, I won't even get an E-mail from the form. I've tried modifying it and the best I can get is for it to have the data without any line breaks. Any help would be appreciated. Thanks in advance.
Code: Select all
<?php
$Firstname = $_REQUEST['FirstName'] ;
$Lastname = $_REQUEST['LastName'] ;
$Phone = $_REQUEST['Phone'] ;
$Email = $_REQUEST['Email'] ;
$Street = $_REQUEST['Street'] ;
$City = $_REQUEST['City'] ;
$State = $_REQUEST['State'] ;
$Zip = $_REQUEST['Zip'] ;
$Message = $_REQUEST['Message'] ;
$Body = "First Name: $Firstname\n Last Name: $Lastname\n\n Phone: $Phone\n E-Mail: $Email\n\n Street: $Street\n City: $City\n State: $State\n Zip Code: $Zip\n\n Comments: $Message" ;
if (!isset($_REQUEST['Email'])) {
header( "Location: http://www.website.com/contact.html" );
}
if (empty($Email) || empty($Phone)){
header( "Location: http://www.website.com/error.html" ); }
else {
mail( "name@example.com", "Contact Form Inquiry", $Body, "From: $Firstname <$Email>" );
header( "Location: http://www.website.com/thankyou.html" );
}
?>