Discussion Locked

Handling multiple submits in a single form with PHP

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
article root

2 replies

by rexworld

One possible alternative way of dealing with multiple-button forms is to attach an onClick() event handler to each button that changes the form through JavaScript. So instead of using a single PHP script, you could actually have different scripts for different actions, with JavaScript taking care of changing the form action using code like this:

...

and so on. Has anyone tried this, and what were the results?

by billc

If javascript is disabled, the fail-over method would require you to handle both of the submit buttons in the form's action url anyway.

This discussion is closed to new replies.