How to make space in php contact form results?

Reply

Join Date: Dec 2007
Posts: 27
Reputation: mcx76 is an unknown quantity at this point 
Solved Threads: 0
mcx76 mcx76 is offline Offline
Light Poster

How to make space in php contact form results?

 
0
  #1
Jan 31st, 2009
Hi,
I am making php from.Everhting is working fine.I am receving result as below.I want to space before Tel no.Please be advice how i can do. Thank you.
---------------------------------------------------
Email Result
--------------------------------------------------
General Info Request
Name: Khan

1665 Bloor Street
Mississauga
L4X3T4
Tel:647-290-0000
Email: hanyon@gmail.com

Best Time To Contact:11am
Message is:
Hi,
---------------------------------------------------

  1. <?php
  2. $name=$_POST['name'];
  3. $phone=$_POST['phone'];
  4. $email=$_POST['email'];
  5. $contact_time=$_POST['Contact_Time'];
  6. $address=$_POST['address'];
  7. $city=$_POST['city'];
  8. $postal=$_POST['postal'];
  9. $message=$_POST['message'];
  10. if($message=="")
  11. {
  12. $message="<b>no message</b>";
  13. }
  14. else
  15. {
  16. $message="<b>Message:</b><br>".$message;
  17. }
  18.  
  19. $emailBody ="<HTML>\n"
  20. ."<head><title></title></head><body>\n"
  21. ."<table bordercolor=red border=\"1\" cellspacing=0 cellpadding=0>\n"
  22. ."<tr><td bgcolor=\"#e9e8d6\" colspan=2 align=center><h3>General Info Request</h3></td></tr>\n"
  23.  
  24. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Name:</b>$name</td>
  25.  
  26. <tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b></b>$address</td>
  27. <td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b></b>$city</td></tr>\n"
  28. ."<tr><td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\" colspan=2><b></b>$postal</td></tr>\n"
  29.  
  30.  
  31. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Tel:</b>$phone</td></tr>\n"
  32. ."<tr><td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\"><b>Email:</b>$email</td>
  33.  
  34. <td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\"><b>Best Time To Contact:</b>$contact_time</td></tr>\n"
  35.  
  36. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\" colspan=2>$message</td></tr>\n"
  37. ."</table></body></html>";
  38.  
  39.  
  40. $emailTo = '"" <info@land.ca>'; //Enter your email instead of email@yourdomain.com
  41. $emailSubject = "FREE DEMONSTRATION";
  42. $emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject);
  43.  
  44. $emailFrom = $email;//from email
  45. $emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);
  46. $emailHeader = "From: $emailFrom\n"
  47. . "Reply-To: $emailFrom\n"
  48. . "Return-Path: $emailFrom\n"
  49. . "X-Sender: $emailFrom\n"
  50. . "X-Mailer: PHP\n"
  51. . "X-Priority: 3\n"
  52. . "MIME-Version: 1.0\n"
  53. . "Content-Type: text/html; charset=\"ISO-8859-1\"\n"
  54. . "Content-Transfer-Encoding: base64\n"
  55. . "\n";
  56. $emailBody=chunk_split(base64_encode($emailBody));
  57.  
  58. mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  59. # Confirmation Email to User
  60.  
  61. $confEmailTo =$email;//from email
  62. $confEmailTo = preg_replace('/[\x00-\x1F]/', '', $confEmailTo);
  63.  
  64. $confEmailSubject = "Confirmation ";
  65. $confEmailSubject = preg_replace('/[\x00-\x1F]/', '', $confEmailSubject);
  66.  
  67. $confEmailBody = "Hello $fname,\n"
  68. . "Thanks for your recent enquiry . We have received your message, we will contact you shortly - Grout Masters\n"
  69. . "\n"
  70. . "";
  71.  
  72. $confEmailHeader = "From: no-reply@yourdomain.com\n"//Enter your email instead of email@yourdomain.com
  73. . "Reply-To: no-reply@yourdomain.com\n"//Enter your email instead of email@yourdomain.com
  74. . "MIME-Version: 1.0\n"
  75. . "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
  76. . "Content-transfer-encoding: 8bit\n";
  77.  
  78. mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader);
  79.  
  80.  
  81. header("location:thankyou.html");//reload
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. ?>
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 49
Reputation: uncle_smith is an unknown quantity at this point 
Solved Threads: 7
uncle_smith uncle_smith is offline Offline
Light Poster

Re: How to make space in php contact form results?

 
0
  #2
Jan 31st, 2009
Originally Posted by mcx76 View Post
Hi,
I am making php from.Everhting is working fine.I am receving result as below.I want to space before Tel no.Please be advice how i can do. Thank you.
---------------------------------------------------
Email Result
--------------------------------------------------
General Info Request
Name: Khan

1665 Bloor Street
Mississauga
L4X3T4
Tel:647-290-0000
Email: hanyon@gmail.com

Best Time To Contact:11am
Message is:
Hi,
---------------------------------------------------

  1. <?php
  2. $name=$_POST['name'];
  3. $phone=$_POST['phone'];
  4. $email=$_POST['email'];
  5. $contact_time=$_POST['Contact_Time'];
  6. $address=$_POST['address'];
  7. $city=$_POST['city'];
  8. $postal=$_POST['postal'];
  9. $message=$_POST['message'];
  10. if($message=="")
  11. {
  12. $message="<b>no message</b>";
  13. }
  14. else
  15. {
  16. $message="<b>Message:</b><br>".$message;
  17. }
  18.  
  19. $emailBody ="<HTML>\n"
  20. ."<head><title></title></head><body>\n"
  21. ."<table bordercolor=red border=\"1\" cellspacing=0 cellpadding=0>\n"
  22. ."<tr><td bgcolor=\"#e9e8d6\" colspan=2 align=center><h3>General Info Request</h3></td></tr>\n"
  23.  
  24. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Name:</b>$name</td>
  25.  
  26. <tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b></b>$address</td>
  27. <td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b></b>$city</td></tr>\n"
  28. ."<tr><td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\" colspan=2><b></b>$postal</td></tr>\n"
  29.  
  30.  
  31. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Tel:</b>$phone</td></tr>\n"
  32. ."<tr><td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\"><b>Email:</b>$email</td>
  33.  
  34. <td bgcolor=\"#d6d68c\" style=\"border:solid 1px #666666;\"><b>Best Time To Contact:</b>$contact_time</td></tr>\n"
  35.  
  36. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\" colspan=2>$message</td></tr>\n"
  37. ."</table></body></html>";
  38.  
  39.  
  40. $emailTo = '"" <info@land.ca>'; //Enter your email instead of email@yourdomain.com
  41. $emailSubject = "FREE DEMONSTRATION";
  42. $emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject);
  43.  
  44. $emailFrom = $email;//from email
  45. $emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);
  46. $emailHeader = "From: $emailFrom\n"
  47. . "Reply-To: $emailFrom\n"
  48. . "Return-Path: $emailFrom\n"
  49. . "X-Sender: $emailFrom\n"
  50. . "X-Mailer: PHP\n"
  51. . "X-Priority: 3\n"
  52. . "MIME-Version: 1.0\n"
  53. . "Content-Type: text/html; charset=\"ISO-8859-1\"\n"
  54. . "Content-Transfer-Encoding: base64\n"
  55. . "\n";
  56. $emailBody=chunk_split(base64_encode($emailBody));
  57.  
  58. mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  59. # Confirmation Email to User
  60.  
  61. $confEmailTo =$email;//from email
  62. $confEmailTo = preg_replace('/[\x00-\x1F]/', '', $confEmailTo);
  63.  
  64. $confEmailSubject = "Confirmation ";
  65. $confEmailSubject = preg_replace('/[\x00-\x1F]/', '', $confEmailSubject);
  66.  
  67. $confEmailBody = "Hello $fname,\n"
  68. . "Thanks for your recent enquiry . We have received your message, we will contact you shortly - Grout Masters\n"
  69. . "\n"
  70. . "";
  71.  
  72. $confEmailHeader = "From: no-reply@yourdomain.com\n"//Enter your email instead of email@yourdomain.com
  73. . "Reply-To: no-reply@yourdomain.com\n"//Enter your email instead of email@yourdomain.com
  74. . "MIME-Version: 1.0\n"
  75. . "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
  76. . "Content-transfer-encoding: 8bit\n";
  77.  
  78. mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader);
  79.  
  80.  
  81. header("location:thankyou.html");//reload
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. ?>
How does the phone number look now and how do you want it to look?
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 357
Reputation: death_oclock will become famous soon enough death_oclock will become famous soon enough 
Solved Threads: 37
death_oclock's Avatar
death_oclock death_oclock is offline Offline
Posting Whiz

Re: How to make space in php contact form results?

 
0
  #3
Jan 31st, 2009
Just because you're printing your HTML with PHP doesn't mean this is a PHP issue...
And you can change this:
  1. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Tel:</b>$phone</td></tr>\n"
To this:
  1. ."<tr><td bgcolor=\"#ffffa0\" style=\"border:solid 1px #666666;\"><b>Tel:</b> $phone</td></tr>\n"
Added a space before $phone. Simple.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 1
Reputation: mindful123 is an unknown quantity at this point 
Solved Threads: 0
mindful123 mindful123 is offline Offline
Newbie Poster
 
0
  #4
6 Days Ago
Would you be able to give me some helps on this because I am getting this message after using your code? Thanks

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\hosting\webhost4life\member\bdstock\bdstock1\marketingad2.php on line 308

Here is my page

http://www.bdstock.com/marketingad2.php
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC