Hang on. You’re telling me to look in $_POST - which is what I would have expected - but that still doesn’t tell me how my Form gets a name and what that name is?!
When added name=‘createAccount’ to my Form, and then I echoed the $_POST array, name was no where to be seen!!
Based on what I have researched, name does not get carried over in the $_POST array and is a throwback to older code.
Doesn’t seem like your code can work.
(BTW, I think I figured a workaround. I just need to unset($_SESSION[‘form_token’]) AFTER my script has successfully validated all Form data. That way, the Form doesn’t need to get reloaded, and a NULL form_token seems to be okay.)
The name attribute on forms is not actually used for anything (except for antiquated JavaScript).
Where you have the same form being submitted for different purposes or different forms being submitted to the same process you need to distinguish between them by the name on the submit button fields. To handle the bug in some IE versions where the submit button name doesn’t get passed when the form is submitted using enter it is always the first submit button that gets triggered in that situation so no value passed for the submit button can be treated the same as the value of the first submit button.