title: redirect to current page if user clicks back or refreshes the page
body: <p>Sorry I have posted this question and I googled it alot still Im unable to solve this </p>
  
  <p>I have a php page that has a form and when user clicks refresh or F5 it creates duplicate values in the database and also a message is alerted to the user, indicating resubmitting may insert duplicate values in database.My boss dont want that alert box of the browser to user and also insertion of duplicate values into the database</p>
  
  <p>I know its <code>header()</code>. I read lot of <code>header()</code> in php manual and also <code>server_name</code> functions but still I tried in many ways putting in the top but cant solve it. its very important. can anyone please help me with a sample of code explaining the way to do.any help is greatly appreciated.</p>
  
  <pre><code> &lt;form method="post" action"demo.php"&gt;
    &lt;input name="fname" type="text"&gt;
    &lt;input type="submit" value="submit"&gt;
   &lt;/form&gt;
   demo.php
    &lt;?php
     $firstname = $_POST['fname'];
     ?&gt;
  </code></pre>
  
  <p>Tell me what should i add in the demo.php page to stop it from submitting the form again and again and also if user clicks back button on the browser it should not direct to the previous page , it should still redirect to current page.</p>
  
  <p>So if user clicks refresh or back button it should redirect to current page only and should not insert any duplicate values and also alert box should be disabled.Please explain me what to do here, im in deep help.Thanks</p>