title: PHP Check which form was submitted
body: <p>I am working on a website where I have 2 forms on 1 page. I use 1 PHP script to check the forms. But if I submit my second form on the page, my website submits the first form. How can I check which form is submitted? </p>
  
  <pre><code>&lt;!--// Form 1--&gt;
  &lt;form method="post"&gt;
  
  &lt;input type="text" name="test"&gt;
  &lt;input type="submit" name="submit"&gt;
  &lt;input type="hidden" name="page_form" value="1"&gt;
  
  &lt;/form&gt;
  
  &lt;!--// Form 2--&gt;
  &lt;form method="post"&gt;
  
  &lt;input type="text" name="test"&gt;
  &lt;input type="submit" name="submit"&gt;
  &lt;input type="hidden" name="page_form" value="2"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>if(isset($_POST['submit'])) {
  
      $forms = array(1, 2);
      foreach($forms as $form) {
  
          if($_POST['page_form'] == $form) {
          // All my form validations which are for every form the same.
  
          }       
      }            
  }    
  </code></pre>