[thelist] javascript confirm dual submit nastiness

Rob Smith rob.smith at THERMON.com
Fri Nov 22 12:59:01 CST 2002


[snip]
I've got a form with TWO submit buttons - one is edit one is delete.
Depending on which button is pressed, my PHP page either gives the
user an edit form with the variable passed by the form filled in - or
it simply deletes the item.
[/snip]

I have a working example of how to fix this and although I can't show it via
a link, I'll tell you how it works.

You have a form that sends via POST or GET, going to a PHP parsing page
right? Simple enough. All you need to do is this:

Scenario A) action="POST" :: Request from the form, the name of the submit
button. If the name = "Edit" then do this action. Else "delete" it.
Scenario B) action="GET"  :: If you look at the query string, you'll notice
that the Submit button name is included as the last item in the query
string. So find out what it is, and proceed from there.

Basically, the structure of your form parsing page is one huge IF...Else...
construct.

Good luck!

Rob.Smith



More information about the thelist mailing list