title: PHP Contact Form return code
body: <p>I have the following PHP script that runs when a send button is clicked. </p>
  
  <pre><code>&lt;?php
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $from = 'From: TangledDemo'; 
  $to = 'shanaywork@gmail.com'; 
  $subject = 'Hello';
  
  $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  
  if ($_POST['submit') {               
      if (mail ($to, $subject, $body, $from)) { 
      echo '&lt;p&gt;Your message has been sent!&lt;/p&gt;';
  } else { 
      echo '&lt;p&gt;Something went wrong, go back and try again!&lt;/p&gt;'; 
  } 
  } else if ($_POST['submit']) {
  echo '&lt;p&gt;You answered the anti-spam question incorrectly!&lt;/p&gt;';
  }
  </code></pre>
  
  <p>?></p>
  
  <p>I am using MAMP to host the website locally. The problem occurs when the send button is hit, instead of the email being sent a page with the code is shown. </p>
  
  <p>What is wrong in my code and how may I fix it?</p>
  
  <p>Thank You.</p>