If I have multiple HTML tags with separate submit forms, how do I know which when was posted in the PHP file that processes the form’s data?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way is to name your submit buttons unique to the form. You can also use this if you have multiple submit buttons for a SINGLE form (eg – submit and save, submit and return, submit and exit)
The $_POST array (or $_GET/$_REQUEST) will contain the key “action” with the value of the enacted button (whether clicked or not).
As a rule, I avoid passing hidden text fields, etc, that are unnecessary – simply to keep the code more clean.
So. For your application, I’d give your submit button values as such: