title: Where is my POST() data going
body: <p>I'm developing a regular form in html using Jquery Ajax and PHP. </p>
  
  <p>When i send the email via php function mail, i'm receiving the next email with the empty fields and I don't know why:</p>
  
  <pre><code>From: 
  E-Mail: 
  Message:
  </code></pre>
  
  <p>The code I'm using: </p>
  
  <p>-PHP (sendMail.php):</p>
  
  <pre><code>&lt;?php
  if($_POST){
      $name    = $_POST['form_name'];
      $email   = $_POST['form_email'];
      $content = $_POST['form_content'];
      $from    = 'Koke Contact Form';
      $to      = 'wheretosendit@gmail.com';
      $subject = 'Someone is contacting';
      $body    = "From: $name\n E-Mail: $email\n Message:\n $content";
  
      //send email
  
      if (mail ($to, $subject, $body)) {
                  $result='&lt;div class="alert alert-success"&gt;Thank You! I will be in touch&lt;/div&gt;';
          } else {
              $result='&lt;div class="alert alert-danger"&gt;Sorry there was an error sending your message. Please try again later&lt;/div&gt;';
          }
      }
  ?&gt;
  </code></pre>
  
  <p>-HTML</p>
  
  <pre><code>&lt;form method = "post" id = "message" action = "sendMail.php"&gt;
      &lt;div class="row"&gt;
          &lt;div class = "yourinfo col-md-6"&gt;
              &lt;div class = "form-group" id = "nombre"&gt;
                  &lt;label for = "input-name"&gt; Tu nombre: &lt;/label&gt;
                  &lt;input id= "form-name" type= "text" class= "form-control gborder" name = "form-name"&gt;
              &lt;/div&gt;          
              &lt;div class = "form-group " id = "email"&gt;
                  &lt;label for = "input-email"&gt; Tu email: &lt;/label&gt;
                  &lt;input id = "form-email" type= "email" class= "form-control gborder" name = "form-email"&gt;
              &lt;/div&gt;
          &lt;/div&gt;                          
          &lt;div class = "form-group col-md-6" id = "comment"&gt;
              &lt;label for = "input-content"&gt; Mensaje: &lt;/label&gt;
              &lt;textarea id = "form-content" class="form-control gborder" rows = "5" name = "form-content"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;div class = "text-center"&gt;
              &lt;input id="submit" name="submit" type="submit" value="ENVIAR" class="btn btn-primary"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>-JQUERY</p>
  
  <pre><code>$('#message').submit(function() {
      if($('#form-name').val() !== "" &amp;&amp; $('#form-email').val() !== "" &amp;&amp; $('#form-content').val() !== "") {
          var data = {
              name: $('#form-name').val(),
              email: $('#form-email').val(),
              content: $('#form-content').val()
          };
          $.ajax({
              type: 'POST',
              url: 'sendMail.php',
              data: data,
              success: function () {              
                  $("html, body").animate({ scrollTop: 0 }, "slow");
                  $('#form-content').val("");
                  $('#form-name').val("");
                  $('#form-email').val("");
              }
          });
      } return false;
  });
  </code></pre>
  
  <p>As I said, I'm receiving the email but the From, E-mail and Message fields are empty. I've been fighting with this since 2 days ago.. I don't know how to fix it. </p>
  
  <p>Thanks for your help!</p>