title: PHP Mail - Any idea why form isn't sending?
body: <p>I'm trying to figure out why this form isn't emailing after submission. I did a test and PHP mail is working correctly on the server. Is something wrong with the headers perhaps?</p>
  
  <p>Thanks in advance for any advice!</p>
  
  <pre><code>     &lt;?php
  
                          if(!empty($_POST['first-name'])) {
  
                          $_POST['email'] = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
  
                          $agree1 = implode(", ", $_POST['certify-info-true']);
                          $agree2 = implode(", ", $_POST['understand-false-info']);
                          $agree3 = implode(", ", $_POST['final-sig']);
  
                          foreach($_POST as $name =&gt; $value) {
                          $value = filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
                              if($name == 'submit') {
                                  //skip
                              }
                              elseif ($name == 'certify-info-true') {
                                  $res .= "$name : $agree1 \n \n";
                              }
                              elseif ($name == 'understand-false-info') {
                                  $res .= "$name : $agree2 \n \n";
                              }
                              elseif ($name == 'final-sig') {
                                  $res .= "$name : $agree3 \n \n";
                              }
                              else {
                              $res .= "$name : $value \n \n";
                              }
                          }
  
                          //SET here the destination email address and subject line
                          mail('test@testmail.com','Application', "$res", "From: {$_POST['email']}");
  
                          //SET here the thank you message
                          echo "&lt;h2&gt;Thank you.&lt;/h2&gt;";
  
                          //print_r($_POST);
                          } else {
  
                      ?&gt;
  
                      &lt;form action="" id="test" method="POST"&gt;&lt;/form&gt;
  &lt;? } ?&gt;
  </code></pre>