By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,225 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,225 IT Pros & Developers. It's quick & easy.

Why won't my simple PHP script work?

P: 1
I used Dreamweaver to build my site and on one of my pages I have a form. I used an online tutorial to build this php file for the form. But everytime a user submits the form it just goes to a blank page and none of the forms get sent to my email.

What is wrong with this code? Thank you for your help!


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. /* Subject and Email Variables */
  4.  
  5.     $emailSubject = 'Sales Inquiry';
  6.     $webMaster = 'sales@endorsebro.com'; 
  7.  
  8. /* Gathering Data Variables */
  9.  
  10.     $name = $_POST['name']; 
  11.     $business_name = $_POST['business_name']; 
  12.     $phone_number = $_POST['phone_number']; 
  13.     $Email = $_POST['Email']; 
  14.     $website = $_POST['website']; 
  15.     $state = $_POST['state']; 
  16.     $budget = $_POST['budget']; 
  17.     $comments = $_POST['comments']; 
  18.  
  19.     $body = <<<EOD
  20. <br><hr><br>
  21. Name: $name <br>
  22. Business Name: $business_name <br>
  23. Phone Number: $phone_number <br>
  24. Email Address: $Email <br>
  25. Website: $website <br>
  26. State: $state <br>
  27. Budget: $budget <br>
  28. Comments: $comments <br>
  29. EOD; 
  30.  
  31.     $headers = "From: $email\r\n";
  32.     $headers .= "Content-type: text/html\r\n";
  33.     $success = mail($webMaster, $emailSubject, $body, $headers);
  34.  
  35. /* Results rendered as html */
  36.  
  37.  
  38.     $theResults = <<<EOD
  39. <html>
  40. <head>
  41. <title>Endorsebro</title>
  42. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  43. <style type="text/css">
  44. <!--
  45. body {
  46.     background-color: #f1f1f1;
  47.     font-family: Verdana, Arial, Helvetica, sans-serif;
  48.     font-size: 12px;
  49.     font-style: normal;
  50.     line-height: normal;
  51.     font-weight: normal;
  52.     color: #666666;
  53.     text-decoration: none;
  54. }
  55. -->
  56. </style>
  57. </head>
  58.  
  59. <div>
  60.   <div align="left">Thank you for your interest! We will be in contact soon!</div>
  61. </div>
  62. </body>
  63. </html>
  64.  
  65. EOD;
  66. echo "$theResults";
  67. }
  68. ?>
  69.  
Apr 14 '11 #1
Share this Question
Share on Google+
1 Reply


code green
Expert 100+
P: 1,726
It is probably not this code but the form HTML
Apr 14 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.