So I've been thinking about this for an hour and am interested in what the best way is to check which form has been submitted.
So lets say we've got formOne
and formTwo
that both submit to formsubmission.php
and inside there I have deemed the most appropriate way to check for SUBMISSION is
if($_SERVER['REQUEST_METHOD'] == 'POST'){
//do stuff
}
But what is the best way to actually determine WHICH form has been submitted, formOne or Two?
I have read here What is the best way to identify which form has been submitted? and am wondering whether these are the only two ways to get around this.
I figured that just checking isset($_POST[formname])
would be bad due to a few reasons I read about elsewhere, but now I am starting to think that the whole idea of posting to the same .php
file is just bad practice and there is no GOOD way to check which form has been submitted doing it this way.
Is using GET and submitting each different form to a seperate ID bad practice? if so - why?
So my question is, what is the best way to check WHICH form has been submitted, that is GOOD practice?
Thanks
PS also looked at hidden fields -> doesn't seem html worthy in terms of quality