title: PHP not getting $_POST inputs from form
body: <p>I am working with PHP <code>mail()</code> and have a contact form which <code>posts</code> the input fields <code>submit</code>. <strong>All</strong> inputs on the html form have a <code>name</code> attr attached to them so PHP can retrieve their values.</p>
  
  <pre><code>&lt;form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php" role="form"&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;input type="text" name="name" class="form-control" required="required" placeholder="Name"&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;input type="text" name="email" class="form-control" required="required" placeholder="Email address"&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-12"&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="Message"&gt;&lt;/textarea&gt;
                                  &lt;/div&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;button type="submit" class="btn btn-danger btn-lg"&gt;Send Message&lt;/button&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>On <code>submit</code> the form is <code>posted</code> to <code>sendemail.php</code> to retrieve the input values and send the email:</p>
  
  <pre><code>&lt;?php
      header('Content-type: application/json');
      $status = array(
          'type'=&gt;'success',
          'message'=&gt;'Email sent!'
      );
  
      $name = @trim(stripslashes($_POST['name']));
      $email = @trim(stripslashes($_POST['email']));
      $subject = @trim(stripslashes($_POST['subject']));
      $message = @trim(stripslashes($_POST['message']));
  
      $email_from = $email;
      $email_to = 'keilcarpenter01@gmail.com';
  
      $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
  
      $success = @mail($email_to, $subject, $body, 'From: &lt;'.$email_from.'&gt;');
  
      echo json_encode($status);
      die;
  </code></pre>
  
  <p>As you can see I am attempting to retrieve the forms values by:</p>
  
  <pre><code>$name = @trim(stripslashes($_POST['name']));
  $email = @trim(stripslashes($_POST['email']));
  $subject = @trim(stripslashes($_POST['subject']));
  $message = @trim(stripslashes($_POST['message']));
  </code></pre>
  
  <p>Which is referencing the correct names attributed to the name of each form input </p>
  
  <p>But its not getting the actual values so when i get an email all the body of the message contains is:</p>
  
  <pre><code>Name:
  Email:
  Subject:
  Message:
  </code></pre>
  
  <p>And not the actual contents of the feilds.</p>
  
  <p>I have read that PHP does not parse POST when your enctype different from <code>application/x-www-form-urlencoded</code> or <code>multipart/form-data</code> but I dont have any <code>enctype</code> attr on my <code>form</code>.</p>
  
  <p>result of var_dump($_POST):</p>
  
  <pre><code>  array(0) {
  }
  </code></pre>
  
  <p>I cant see where I have gone wrong</p>