title: Why is this form not submitted twice when hitting the button twice?
body: <p><strong>Edit 25.07.2018:</strong> As Pawnesh Kumar said in the answer, this seems to be a browser issue. If I hit the button multiple times in Firefox the below script will only send one <code>POST</code> request, but if I do the same in Chrome I get a <code>POST</code> request for each click.</p>
  
  <p>However, I can replicate the problem in the <a href="https://www.youtube.com/watch?v=gJRv2ahMzEg" rel="nofollow noreferrer">video</a> at 01:00. This means when I install Laravel with <a href="https://laravel.com/docs/5.6/authentication#authentication-quickstart" rel="nofollow noreferrer">Authentication</a>, then if I click the submit button in the login form twice, Firefox will send 2 requests.</p>
  
  <p><strong>Why is Firefox sometimes sending multiple <code>POST</code> request and sometimes only one, when clicking multiple times on the button?</strong></p>
  
  <hr>
  
  <p>I have a <strong>user</strong> table</p>
  
  <pre><code>id | name
   1 | John
  </code></pre>
  
  <p>where the field <code>id</code> is a primary, integer, auto-incremet key. When I submit a dummy form that only has one button, then this will insert a new record with name <code>John</code>. Now this is what I observed:</p>
  
  <ul>
  <li><p>If I submit the form once, go back in the browser submit it again, then
  I find two new rows in the DB.</p></li>
  <li><p>If I submit the form by clicking twice (or twenty times) on the <code>Add</code>
  button, then there is only a single new row in the DB. </p></li>
  </ul>
  
  <p>Why is that? I would expect that if I hit the submit button multiple times, then the form will send multiple requests - and inserts multiple rows.</p>
  
  <p>Thats my form:</p>
  
  <pre><code>&lt;form action="/test.php" method="POST"&gt;
    &lt;input type="submit" value="Add"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>which submits to <code>test.php</code>:</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "adam";
  $password = "password";
  $dbname = "test-db";
  
  $conn = new mysqli($servername, $username, $password, $dbname);       
  $sql = "INSERT INTO user (name) VALUES ('John')";
  if ($conn-&gt;query($sql) === TRUE) {
      echo "New record created successfully";
  }     
  $conn-&gt;close();
  
  sleep(4);
  </code></pre>
  
  <p>Because of the <code>sleep</code> part, I can click on the <code>Add</code> button multiple times in a row. However, no matter how often I click the <code>Add</code> button while loading, there is only one new row in the DB.</p>
  
  <p>In my access.log file I also find only one <code>GET</code> and <code>POST</code> request after clicking the button twenty times:</p>
  
  <blockquote>
    <p>2001:****:****:4400:****:****:****:**** - - [25/Jul/2018:11:30:03 +0200] "GET /test/form.php HTTP/1.1" 200 301 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" "*******.net"</p>
    
    <p>2001:****:****:4400:****:****:***:**** - - [25/Jul/2018:11:30:34 +0200] "POST /test/test.php HTTP/1.1" 200 31 "http://********.net/test/form.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" "********.net"</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Remark:</strong></p>
  
  <p>I have read about techniques to prevent multiple submissions either 
  in the <a href="https://stackoverflow.com/a/4614123/2311074">backend</a> or <a href="https://stackoverflow.com/a/4614103/2311074">frontend</a>. Thus I think it should be possible to submit the form multiple times by hitting the button multiple times.</p>
  
  <p>I also read in the wiki article <a href="https://en.wikipedia.org/wiki/Post/Redirect/Get" rel="nofollow noreferrer">Post/Redirect/Get</a> that this pattern can not prevent if a user sumbits a form multiple times too quick:</p>
  
  <blockquote>
    <p>If a web user refreshes before the initial submission has completed because of server lag, resulting in a duplicate POST request in certain user agents.</p>
  </blockquote>
  
  <p>Also in this <a href="https://www.youtube.com/watch?v=gJRv2ahMzEg" rel="nofollow noreferrer">video</a> at 1:00 someone double clicks on a button and gets an error because he submitted twice.</p>