hello all, so i have this contact form im working on for my website.. so far it works great but the format is coming out mis-aligned once i receive the email in my inbox..
Here is my code on my page.
Code:
<form method="post" action="contact.php">
<input size=25 name="First_Name">
<input size=25 name="Last_Name">
<input size=25 name="Email">
<input size=25 name="Order_Number">
<select name="sendto">
<option value="general@mysite.com">General</option>
<option value="support@mysite.com">Support</option>
<option value="sales@mysite.com">Sales</option>
</select>
<input size=25 name="Phone">
<textarea name="Message" rows=5 cols=35></textarea>
<input type=submit name="send" value="Submit">
</form>
and here the code on my contact.php page which processes the info.
PHP Code:
<?php $to = $_REQUEST['sendto'] ; $from = $_REQUEST['Email'] ; $first_name = $_REQUEST['First_Name'] ; $headers = "From: $from"; $subject = "Website Contact Form"; $fields = array(); $fields{"First_Name"} = "First Name"; $fields{"Last_Name"} = "Last Name"; $fields{"Order_Number"} = "Order Number"; $fields{"Email"} = "Email"; $fields{"Phone"} = "Phone"; $fields{"Message"} = "Message"; $body = "Website Contact Form\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: noreply@YourDomain.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please call us at 1-888-888888)"; if($from == '') {print "You have not entered an email, please go back and try again";} else { if($first_name == '') {print "You have not entered a name, please go back and try again"; } else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) {header( "Location: http://www.YourDomain.com/thankyou.html" ); } else {print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; } } } ?>
Everything works great except that when i receive the email in my inbox this is how it shows up:
I'd appreciate any help i could get.
Thanks.
|