title: Using onclick for a submit button
body: <p>I have multiple submit buttons. As far as the php is concerned, they do the same thing, send input data to database. But i want to also run some javascript when specific buttons are clicked and i am having trouble.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;div id="btnGroup"&gt;
      &lt;input type="submit" id= "btn1" value="6 seats" onclick="myFunction()"/&gt;
      &lt;input type="submit" id= "btn2" value="6 seats"  onclick="myFunction()"/&gt;
      &lt;input type="submit" id= "btn3" value="6 seats" onclick="myFunction()"/&gt;
      &lt;input type="submit" id= "btn4" value="6 seats" onclick="myFunction()"/&gt;
      &lt;input type="submit" id= "btn5" value="6 seats" onclick="myFunction()"/&gt;
      &lt;input type="submit" id= "btn6" value="6 seats" onclick="myFunction()"/&gt;    
  &lt;/div&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>function myFunction(){
    alert("button clicked");
  }
  </code></pre>
  
  <p>the function is not what i want in the end it is just something simple to test if it works.</p>
  
  <p>in case this is relevant, the php associated with the buttons works fine. Once a button is clicked, i go to another page that essentially tells me that my php commands worked. Ideally I' want the javascript to run before the php.</p>