title: HTML Email Contact Form
body: <p>Hi all I am new to PHP and seem to be going wrong somewhere while creating a contact form which emails responses to me.</p>
  
  <p>My form is a standard form asking for name, email address, location and a message which is then forwarded to me as an email.</p>
  
  <p>My PHP is:</p>
  
  <pre><code>&lt;?php
  // Check for empty fields
  if(empty($_POST['name'])      ||
     empty($_POST['email'])     ||
     empty($_POST['location'])  ||
     empty($_POST['message'])   ||
     !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
     {
     echo "No arguments Provided!";
     return false;
     }
  
  $name = strip_tags(htmlspecialchars($_POST['name']));
  $email_address = strip_tags(htmlspecialchars($_POST['email']));
  $location = strip_tags(htmlspecialchars($_POST['location']));
  $message = strip_tags(htmlspecialchars($_POST['message']));
  
  // Create the email and send the message
  $to = 'to email';
  $email_subject = "Website Contact Form:  $name";
  $email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nLocation: $location\n\nMessage:\n$message";
  $headers = "From: from email"; 
  $headers .= "Reply-To: $email_address";   
  mail($to,$email_subject,$email_body,$headers);
  return true;         
  ?&gt;
  </code></pre>
  
  <p>My contact form has been working perfectly until I added the "location" section, following which it now fails and does not send the email to my inbox.</p>
  
  <p>Is there something I am missing?</p>