Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

formatting php email form

Engaged ,
Nov 26, 2012 Nov 26, 2012

I have a working form that sends to a php page for processing. however there is a line of code that i dont understand. In the email the form us currently centred but i really need it aligned left.

below is one field and the alignment code

$fields{"field1"} = "text showing in email";

$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){           $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

can i delete the above code and put the $fields{"field1"} = "text showing in email"; into a table

thanks in advance

TOPICS
Server side applications
764
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2012 Nov 27, 2012

Please show all of the code of the php page

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 27, 2012 Nov 27, 2012
LATEST

<?php

$to = $_REQUEST['sendto'] ;

$from = $_REQUEST['email'] ;

$name = $_REQUEST['fullName'] ;

$headers = "From: $from";

$subject = "rent a property website application";

$fields = array();

$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";

$fields{"rentLocation"} = "Where are you interested in renting";

$fields{"rentalAmount"} = "What is the maximum rental payment per month";

$fields{"propertyType"} = "What sort of property are you interested in";

$fields{"smoker"} = "Smoker";

$fields{"employmentStatus"} = "Employment status";

$fields{"numberOfPeople"} = "How many people will live in the property";

$fields{"numberOfChildren"} = "How many children";

$fields{"date"} = "Intended moving in date";

$fields{"month"} = "Intended moving in month";

$fields{"year"} = "Intended moving in year";

$fields{"funds"} = "Have you funds available";

$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@propsite.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 consult our website at www.propsite.com";

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.propsite.com/propsite/index.php" );}

else

{print "We encountered an error sending your mail, please notify webmaster@propsite.com"; }

}

}

?>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines