PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 4th, 2012, 05:12 AM
jonnyfreak jonnyfreak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 67 jonnyfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 54 m 55 sec
Reputation Power: 1
PHP-General - 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

Reply With Quote
  #2  
Old December 4th, 2012, 05:53 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,881 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 9 h 36 m 16 sec
Reputation Power: 813
Hi,

read the documentation on printf(), especially the part on the alignment specifier.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Align php email form

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap