Hi, i have a simple contact.php form on my website, but when i get the email with the information its just a list with no formatting at all and its quite difficult to understand. this is my code.
<?php
$to = "example@example.com" ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Online Order";
$fields = array();
/////info/////////////////////////////
$fields{"Size1"} = "Size 1";
$fields{"Size2"} = "Size 2";
$fields{"Size3"} = "Size 3";
//////////Person Details//////////////
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
/////////Misc Message////////////////////////
$fields{"Message"} = "Message";
$body = "You have received the following info online:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: info@mysite.co.uk";
$subject2 = "Thanks";
$autoreply = "Thanks for contacting us, someone will be in touch with you soon";
$headers2 = "From: info@mysite.co.uk";
$subject2 = "Thanks";
$autoreply = "Thanks for contacting us, someone will be in touch with you soon";
$spam = $_REQUEST['spam'] ;
$correct = "";
if ($spam > $correct) {print "The result you entered for 2+2+1 is too high, please go back and try again.";}
else {
if($spam < $correct) {print "The result you entered for 2+2+1 is too low, please go back and try again";}
else {
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($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.mysite.co.uk/Thanks.html" );}
else
{print "We encountered an error sending your mail, please notify admin@mysite.co.uk"; }
}
}
}
}
?>
What i would like is to be able to make the information that is sent to me be formatted, so its more readable. at the moment i get something like this and its always always all centred on the page.
Size 1: 2 feet
Size 2: 3 feet
Size 3: 4 feet
Name: Mr Johnson
Email: [email]mrjohnson@email.com[/email]
Phone: 1234567
Message: Hi this is a the message that would come with misc info
What i want is an output more like this...
Size 1: 2 feet
Size 2: 3 feet
Size 3: 4 feet
Name: Mr Johnson
Email: mrjohnson@email.com
Phone: 1234567
Message: Hi this is a the message that would come with misc info
Any help would be greatly appreciated. Thanks.