title: Send form to mail via PHP, without page refresh and fields cleared
body: <p>I have a form on my website, which sends the information to my email via PHP code. It all works like a charm, though when I submit the form it refreshes/reloads the page.      </p>
  
  <p>Is there a way to make it so that when the user clicks the submit button that the page won't refresh and the fields will be cleared as well?</p>
  
  <p>I've been finding many posts by people with the same problem here on SO, though it's not all working for me.</p>
  
  <p>What I already tried: using an iFrame. The page then didn't refresh, and the fields wouldn't get cleared.</p>
  
  <p>What's the best thing for me to do? </p>
  
  <h3>HTML:</h3>
  
  <pre><code>                &lt;form class="contact-form" action="form.php" method="post"&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="col-md-6"&gt;
                              &lt;input type="text" name="name" placeholder="Naam" class="form-control" required&gt;
                              &lt;input type="email" name="email" placeholder="E-mail" class="form-control" required&gt;
                              &lt;input type="text" name="subject" placeholder="Onderwerp" class="form-control" required&gt;
                          &lt;/div&gt;
                          &lt;div class="col-md-6"&gt;
                              &lt;textarea type="text" name="message" placeholder="Bericht..." id="message" rows="25" cols="10" class="form-control" required&gt;&lt;/textarea&gt;
                              &lt;button type="submit" name="submit" class="btn btn-default submit-btn form_submit"&gt;VERSTUUR BERICHT&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <h3>PHP:</h3>
  
  <pre><code>if (isset($_POST["submit"])) {if (isset($_POST["submit"])) {
  $nam = $_POST["name"];
  $ema = $_POST["email"];
  $sub = $_POST["subject"];
  $mes = $_POST["message"];
  
  $your_email = "testertje777@gmail.com";
  $subject = $sub;
  $email_body = $mes;
  
  if (isset($_REQUEST['message'])) {
      mail ($your_email, $subject, $email_body, "From: $nam &lt;$ema&gt;");
      header ("Location: bomatec.be");
      exit();
  }
  }
  </code></pre>