title: Clear form and redirect back to index
body: <p>I have a form which takes input and enters it into the database. This is fine and working perfectly, except I have run into an issue with clearing the form. In Wamp it merely takes me to contactForm.php, which is a blank page. I have been trying to find a way of redirecting the user back to index.php and clearing the form. From searching around I have tried a couple of things (perhaps incorrectly) including putting this at the end of my php: </p>
  
  <pre><code>header('Location: http://stackoverflow.com');
  </code></pre>
  
  <p>and I also tried to write a JS function to do it</p>
  
  <pre><code>&lt;p&gt;&lt;input type="submit" name="submit" value="Submit" onclick="clearForm();"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>js</p>
  
  <pre><code>function clearForm(){
      alert("Thanks, we will be in touch shortly");
      document.getElementById("contactForm").reset();
  }
  </code></pre>