title: Why is button considered pressed on page refresh and page access?
body: <p>I have a simple submit form in <code>index.php</code>:</p>
  
  <pre><code>&lt;?php
      include('inputs.php');
  ?&gt;
          &lt;form method="post" action= "/index.php"&gt;
              &lt;input class="button" id="restart_device" name="restart_device" type="submit" value="Restart Display" /&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>and an action in <code>inputs.php</code> file:</p>
  
  <pre><code>if(isset($_POST['restart_device'])) {
      shell_exec("sudo /var/www/html/restart_device.sh");
  }
  </code></pre>
  
  <p>The issue is that this code gets executed on every page refresh or every time I access the page. I don't want this behavior. I want to execute <code>shell_exec("sudo /var/www/html/restart_device.sh");</code> only on button press, not on page access or page refresh.</p>
  
  <p>I have also tried using <code>&lt;form method="post" action= ""&gt;</code> but with no success.</p>