title: How to prevent form submission on page load/refresh in php?
body: <p>I am working on a <strong>html/php code</strong> as shown below in which I want to call a particular section of php code on click of a button. </p>
  
  <pre><code>&lt;html&gt; 
      &lt;?php 
       if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['go-button'])) {
       for each  ($mp4_files as $f) {
  
       }
      }
      ?&gt;
  
    &lt;form action ="" method="POST"&gt;
      &lt;table&gt;
         &lt;td style="width:5%; text-align:center;"&gt;&lt;button style="width:90px;" type="submit" name="go-button" value="Go"  class="btn btn-outline-primary"&gt;Go&lt;/button&gt;  &lt;!-- Line#B --&gt;
     &lt;/table
    &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>On click of a button at <strong>Line#B</strong>, the php code is call above and it goes inside the <strong>if block</strong>. </p>
  
  <p>The issue which I am having right now is that on refresh of a page, it is also going inside the if block which I don't want to happen. I want if block to be active only on click of <strong>Go button</strong>. </p>
  
  <p><strong>Problem Statement:</strong></p>
  
  <p>I am wondering what changes I should make in the <strong>php code above</strong> so that on refresh of a page it doesn't go inside the if block. It should go only on click of a button at <strong>Line#B</strong>.  </p>