Redirect from PHP file to HTML file? : <p>So i have a contact form on my website. However when i submit it redirects me from my html page to the PHP page, id like to automatically redirect back. I have tried using HTACCESS but it redirects straight away and the PHP script doesnt run.</p>

<p><strong>HTML FORM</strong></p>

<pre><code>&lt;form action="action.php" method="post" class="contactForm" target="_top"&gt;
  &lt;input type="name" name="field1" placeholder="Enter your name..."&gt;&lt;br&gt;
  &lt;input type="email" name="field2" placeholder="Enter your email address..."&gt;&lt;br&gt;
 &lt;input type="text" name="field3" placeholder="Enter your message..."&gt;&lt;br&gt;
 &lt;input type="submit" value="Submit" id="button"&gt;
&lt;/form&gt;
</code></pre>

<p><strong>action.php</strong></p>

<pre><code>&lt;?php

 $path = 'data.txt';
 if (isset($_POST['field1']) &amp;&amp; isset($_POST['field2'])&amp;&amp; isset($_POST['field3'])) {
    $fh = fopen($path,"a+");
    $string = $_POST['field1'].' - '.$_POST['field2'].' - '.$_POST['field3'];
    fwrite($fh,$string);
    fclose($fh);
 }?&gt;
</code></pre>

<p>If i am going about this the wrong way please let me know, i am a complete beginner to PHP so i know very little.</p>

<p>Thanks.</p>
