I use Zend-Form to generate my forms in my project.
First: How do you handle multiple forms on the same page, and only post the form that is submitted?
Second: When I have two forms on the same page the token will only validate the topmost rendered form in the HTML. The second form with get a “Token does not match” error, thus making the form unable to post. How do you give each form a unique token that does not conflict with the others?
Sincerely, Why
Tokens on multiple forms are not possible with the current implementation (see
initCsrfValidator).I suggest you generate your own token, store it in the session (with the form ID) and validate it yourself.