title: form input to javascript to php
body: <p>I don't understand what the problem is, I'm left confused. I assume the problem might be very simple as I am new to PHP.</p>
  
  <p><strong>My form:</strong></p>
  
  <pre><code>&lt;form name="sentMessage" id="contactForm" novalidate&gt;
                          &lt;div class="row control-group"&gt;
                          &lt;label&gt;Name&lt;/label&gt;
                              &lt;div class="form-group col-xs-12 floating-label-form-group controls"&gt;
                                  &lt;input type="text" class="form-control" placeholder="Name" id="name" required data-validation-required-message="Please enter your name."&gt;
                                  &lt;p class="help-block text-danger"&gt;&lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;!-- Email Address --&gt;
                          &lt;div class="row control-group"&gt;
                          &lt;label&gt;Email Address&lt;/label&gt;
                              &lt;div class="form-group col-xs-12 floating-label-form-group controls"&gt;
                                  &lt;input type="email" class="form-control" placeholder="Email Address" id="email" required data-validation-required-message="Please enter your email address."&gt;
                                  &lt;p class="help-block text-danger"&gt;&lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;!-- Home Location --&gt;
                          &lt;div class="row control-group"&gt;
                          &lt;label&gt;Home Location&lt;/label&gt;
                              &lt;div class="form-group col-xs-12 floating-label-form-group controls"&gt;
                                  &lt;input type="text" class="form-control" placeholder="Home Location" id="homelocation" required data-validation-required-message="Please enter your home location."&gt;
                                  &lt;p class="help-block text-danger"&gt;&lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;!-- Phone Number --&gt;
                          &lt;div class="row control-group"&gt;
                          &lt;label&gt;Phone Number&lt;/label&gt;
                              &lt;div class="form-group col-xs-12 floating-label-form-group controls"&gt;
                                  &lt;input type="tel" class="form-control" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number."&gt;
                                  &lt;p class="help-block text-danger"&gt;&lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                           &lt;div class="row control-group"&gt;
                          &lt;label&gt;How did you hear about us?&lt;/label&gt;&lt;br&gt;
                          &lt;div class="form-group col-xs-12 floating-label-form-group controls"&gt;
                              &lt;select name="advert" &lt;!-- To configure --&gt;&gt;
                                &lt;option value="google"&gt;Google Search&lt;/option&gt;
                                &lt;option value="trademe"&gt;Trademe&lt;/option&gt;
                              &lt;/select&gt;
                              &lt;p class="help-block text-danger"&gt;&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS:</strong></p>
  
  <pre><code>submitSuccess: function($form, event) {
      // Prevent spam click and default submit behaviour
      $("#btnSubmit").attr("disabled", true);
      event.preventDefault();
  
      // get values from FORM
      var name = $("input#name").val();
      var email = $("input#email").val();
  
      var phone = $("input#phone").val();
      var homelocation = $("input#homelocation").val();
      ....
      $.ajax({
              url: "././mail/contact_me.php",
              type: "POST",
              data: {
                  name: name,
                  phone: phone,
                  email: email,
                  homelocation: homelocation,
                  .........
  </code></pre>
  
  <p>and my <strong>php:</strong></p>
  
  <pre><code>&lt;?php
  // Check for empty fields
  if(empty($_POST['name'])        ||
     empty($_POST['email'])       ||
     empty($_POST['phone'])       ||
     empty($_POST['homelocation'])    ||
     !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']));
  $phone = strip_tags(htmlspecialchars($_POST['phone']));
  $homelocation = strip_tags(htmlspecialchars($_POST['homelocation']));
  ..............
  </code></pre>
  
  <p>The code works perfectly fine if I comment out <code>homelocation</code>, I have no idea why.</p>
  
  <p>I am new to PHP so I am a bit confused as to why the above code doesn't work, but if <code>homelocation</code> is commented out, then it works. The name and <code>homelocation</code> have the same input type, so I don't think data type has anything to do with it, and I am sure the variable names are used correctly, could someone please point me to the right direction on this one.</p>
  
  <p>Thanks!</p>