title: Contact Form: Email Not Sent
body: <p>My contact form does not send an email when the user inputs their contact details and presses the submit button. What am I doing wrong?</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>    &lt;div class="row"&gt;
      &lt;form action="mail.php" accept-charset="utf-8" method="post"&gt;
      &lt;div class="form-group contacts-form-result"&gt;
      &lt;div class="col-xs-12"&gt;
      &lt;strong&gt;&lt;/strong&gt;    
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group clearfix"&gt;
      &lt;div class="col-xs-12 col-md-6"&gt;
      &lt;input type="text" placeholder="Your name *" name="name" class="form-control" required&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group clearfix"&gt;
      &lt;div class="col-xs-12 col-md-6"&gt;
      &lt;input type="email" placeholder="Your e-mail address *" name="email" class="form-control" required&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group clearfix"&gt;
      &lt;div class="col-xs-12"&gt;
      &lt;textarea placeholder="Your message *" rows="7" name="message" class="form-control" required&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group clearfix"&gt;
      &lt;div class="col-xs-12"&gt;
      &lt;button type="submit" class="btn btn-2"&gt;Send Enquiry&lt;/button&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;?php
  
  if (isset($_POST['submit'])){
    $subject = $_POST['subject'];
    $name = $_POST['name'];
    $mailFrom = $_POST['email'];
    $message = $_POST['message'];
  
    $mailTo = "myemail@email.com";
    $headers = "Enquiry from: ".$mailFrom;
    $txt = "Name: ".$name."\n"."Message: ".$message;
  
  mail($mailTo, $subject, $txt, $headers);
  
   header("Location: success.html?mailsent");
  
  }?&gt;
  </code></pre>
  
  <p>How can I fix this, so that on button press, an email is sent? Thank you.</p>