php - How to handle two submit buttons in my form -


I am trying to create two submit buttons in my form

    

My question is, which button does the user click on my test.php page?

You have to add the name attribute to your button

  & lt; Button class = "BTN BTN-Priority" type = "submit" name = "old" value = "old" & gt; First button & Lt; / Button & gt; & Lt; Button class = "btn btn-primary" type = "submit" name = "new" value = "new" & gt; The second button & lt; / Button & gt; The PHP code using   

will look like this:

  if ($ _SERVER ['REQUEST_METHOD'] === 'POST') {// Some related Question: If (isset ($ _ POST ['old'])) {// old} elseif (isset ($ _ POST ['new']) {// new}}   

Related Questions:

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -