December 4th, 2012, 05:12 AM
-
Align php email form
Hello i have a php form script that works well but the output email makes all the content centred. i really need it aligned left. can anyone help please?
this is what i have so far:
PHP Code:
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['email'] ;
$name = $_REQUEST['fullName'] ;
$headers = "From: $from";
$subject = "website application";
$fields{"title"} = "Title";
$fields{"fullname"} = "Full Name";
$fields{"teleNumber"} = "Telephone Number";
$fields{"mobileNumber"} = "Mobile Number";
$fields{"email"} = "Email Address";
$fields{"contactMethod"} = "Preferred method of contact";
$fields{"currentAddress"} = "Current Address";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: noreply@website.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible.";
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.website.com/index.php" );}
else
{print "We encountered an error sending your mail, please notify webmaster@website.com"; }
}
}
?>
i thinks it has something to do with
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
but i dont know where to start
thanks in advance
December 4th, 2012, 05:53 AM
-