title: HTML form returning raw PHP code
body: <p>I have a form and I would like the contents to be mailed to an email address, the problem I'm having is that anytime I hit the submit button, the page just shows the raw PHP code and no email is being sent. I took out the email address, but I just have a yahoo account in there now for testing purposes. I am running this locally through WAMP with wordpress installed and have no issues with Wordpress. Any thoughts?</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form id="signup" autocomplete="on" method="post" name="contactform" action="http://localhost/contact-form-handler.php"&gt;
  &lt;div id="prayerRequest"&gt;&lt;/div&gt;&lt;!-- END prayerRequest --&gt;
  &lt;textarea class="text" name="prayer" placeholder="* Prayer Request" required=""&gt;&lt;/textarea&gt;&lt;br&gt;
  &lt;select name="title" class="dropDown" required=""&gt;
      &lt;option disabled="disabled" selected="selected"&gt;* Title&lt;/option&gt;
      &lt;option value="Mr"&gt;Mr.&lt;/option&gt;
      &lt;option value="Ms"&gt;Ms.&lt;/option&gt;
      &lt;option value="Mrs"&gt;Mrs.&lt;/option&gt;
      &lt;option value="Dr"&gt;Dr.&lt;/option&gt;
      &lt;option value="Rev"&gt;Rev.&lt;/option&gt;
      &lt;option value="Pastor"&gt;Pastor&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" class="multiple" name="first" placeholder="* First Name" required=""&gt;
  &lt;input type="text" class="multiple" name="last" placeholder="* Last Name" required=""&gt;&lt;br&gt;
  &lt;input type="email" class="full" name="email" placeholder="* Email Address" required=""&gt;&lt;br&gt;
  &lt;input type="text" class="full" name="address" placeholder="* Street Address 1" required=""&gt;
  &lt;input type="text" class="full" placeholder="Street Address 2"&gt; 
  &lt;input type="text" class="multiple" name="city" placeholder="* City" required=""&gt;
  &lt;button type="submit" class="submit"&gt;Submit Prayer Request&lt;/button&gt;
  &lt;p&gt;*Required Field&lt;/p&gt;  
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php 
  $errors = '';
  $myemail = 'myemail@domain.com';//&lt;-----Put Your email address here.
  if(empty($_POST['first'])  || 
  empty($_POST['email']) || 
  empty($_POST['prayer']))
  {
  $errors .= "\n Error: all fields are required";
  }
  
  $name = $_POST['first']; 
  $email_address = $_POST['email']; 
  $message = $_POST['prayer']; 
  
  if (!preg_match(
  "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", 
  $email_address))
  {
  $errors .= "\n Error: Invalid email address";
  }
  
  if( empty($errors))
  {
  $to = $myemail; 
  $email_subject = "Contact form submission: $name";
  $email_body = "You have received a new message. ".
  " Here are the details:\n Name: $first \n Email: $email_address \n Message \n        $prayer"; 
  
  $headers = "From: $myemail\n"; 
  $headers .= "Reply-To: $email_address";
  
  mail($to,$email_subject,$email_body,$headers);
  //redirect to the 'thank you' page
  header('Location: contact-form-thank-you.html');
  } 
  ?&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd"&gt; 
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Contact form handler&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;!-- This page is displayed only if there is some error --&gt;
  &lt;?php
  echo nl2br($errors);
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>