title: Php Email script
body: <p>Below is my php script: I have a page where a client fills in the form and the data gets proceced by this form and email me the data in nice tables. however the variables display instead of the data. (ie $name)</p>
  
  <p>Please help.</p>
  
  <pre><code>&lt;?php
  
  $fullname=$_POST['fullname'];
  $companyname=$_POST['companyname'];
  $idnumber=$_POST['idnumber'];
  $dob=$_POST['dob'];
  $addressone=$_POST['addressone'];
  $addresstwo=$_POST['addresstwo'];
  $postalcode=$_POST['postalcode'];
  $citystate=$_POST['citystate'];
  $country=$_POST['country'];
  $mobile=$_POST['mobile'];
  $homework=$_POST['homework'];
  $email=$_POST['email'];
  $altemail=$_POST['altemail'];
  $dob=$_POST['dob'];
  $tc=$_POST['tc'];
  $username=$_POST['username'];
  $password=$_POST['password'];
  
  //define the receiver of the email
  $to = 'test@test.com';
  //define the subject of the email
  $subject = 'Test HTML email'; 
  //create a boundary string. It must be unique 
  //so we use the MD5 algorithm to generate a random hash
  $random_hash = md5(date('r', time())); 
  //define the headers we want passed. Note that they are separated with \r\n
  $headers = "From: test@test.com\r\nReply-To: test@test.com";
  //add boundary string and mime type specification
  $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
  //define the body of the message.
  ob_start(); //Turn on output buffering
  ?&gt;
  --PHP-alt-&lt;?php echo $random_hash; ?&gt;  
  Content-Type: text/html; charset="iso-8859-1" 
  Content-Transfer-Encoding: 7bit
  
  &lt;span style="font-family: Arial; font-size:16pt; color: #595959;"&gt;&lt;strong&gt;New Account Registration&lt;/strong&gt;&lt;/span&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
  
  &lt;span style="font-family: Arial; font-size:12pt; color: #595959;"&gt; $fullname has filled in the following information:&lt;p&gt;
  &lt;/span&gt;
  
  
  &lt;table cellspacing"2" border="0" "cellpadding="5px" style="font-family: Arial; font-size: 11pt; color: #777777;"&gt;
  
  
  &lt;tr&gt;  &lt;!-- Full Name --&gt;
       &lt;td&gt;* Full Name:&lt;/td&gt;
       &lt;td&gt;&lt;?php echo '$fullname'; ?&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  
  &lt;tr&gt;  &lt;!-- Company Name --&gt;
       &lt;td&gt;* Company Name:&lt;/td&gt;
       &lt;td&gt;$companyname&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- ID Number / Passport Number --&gt;
       &lt;td&gt;* ID Number / Passport No.&lt;/td&gt;
       &lt;td&gt;$idnumber&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Date of Birth --&gt;
       &lt;td&gt;* Date of Birth&lt;/td&gt;
       &lt;td&gt;$dob&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Address Line 1 --&gt;
       &lt;td&gt;* Address Line 1&lt;/td&gt;
       &lt;td&gt;$addressone&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Address Line 2 --&gt;
       &lt;td&gt;* Address Line 2&lt;/td&gt;
       &lt;td&gt;$addresstwo&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Postal Code  --&gt;
       &lt;td&gt;* Postal Code&lt;/td&gt;
       &lt;td&gt;$postalcode&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- City / State  --&gt;
       &lt;td&gt;* City / State&lt;/td&gt;
       &lt;td&gt;$citystate&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Country  --&gt;
       &lt;td&gt;* Country&lt;/td&gt;
       &lt;td&gt;$country&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;&lt;td&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Mobile Number  --&gt;
       &lt;td&gt;* Mobile Number&lt;/td&gt;
       &lt;td&gt;$mobile&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Home / Work  --&gt;
       &lt;td&gt;* Home / Work No.&lt;/td&gt;
       &lt;td&gt;$homework&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Email Address  --&gt;
       &lt;td&gt;* Email Address:&lt;/td&gt;
       &lt;td&gt;$email&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;  &lt;!-- Alternate Address  --&gt;
       &lt;td&gt;* Alternate Address:&lt;/td&gt;
       &lt;td&gt;$altemail&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Username --&gt;
       &lt;td&gt;* Username:&lt;/td&gt;
       &lt;td&gt;$username&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Password --&gt;
       &lt;td&gt;* Password:&lt;/td&gt;
       &lt;td&gt;$password&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;  &lt;!-- Terms and Conditions --&gt;
       &lt;td colspan="2"&gt;$tc Agreed to the &lt;a href="http://www.test.html"&gt;Terms &amp; Conditions&lt;/a&gt;.&lt;/td&gt;
       &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  --PHP-alt-&lt;?php echo $random_hash; ?&gt;--
  &lt;?
  //copy current buffer contents into $message variable and delete current output buffer
  $message = ob_get_clean();
  //send the email
  $mail_sent = @mail( $to, $subject, $message, $headers );
  //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
  echo $mail_sent ? "Mail sent" : "Mail failed";
  ?&gt;
  </code></pre>