I am working on a html/php code as shown below in which I want to call a particular section of php code on click of a button.
<html> 
    <?php 
     if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['go-button'])) {
     for each  ($mp4_files as $f) {
     }
    }
    ?>
  <form action ="" method="POST">
    <table>
       <td style="width:5%; text-align:center;"><button style="width:90px;" type="submit" name="go-button" value="Go"  class="btn btn-outline-primary">Go</button>  <!-- Line#B -->
   </table
  </form>
</html>
On click of a button at Line#B, the php code is call above and it goes inside the if block.
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 Go button.
Problem Statement:
I am wondering what changes I should make in the php code above 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 Line#B.