beginning_php thread: SV: Multiple submit buttons
Message #1 by Rodolphe Toots <Rudde@I...> on Wed, 18 Sep 2002 11:06:24 +0200|
if i was to do this i would set the type of the buttons to "button" and
onclick action to them specifying where to submit the form
<input type=3D"button" name=3D"cancel" value=3D"Cancel"
<input type=3D"button" name=3D"complete" value=3D"Complete"
if(confirm("Click OK to cancel this order"))
document.myForm.action =3D "cancelscript.php"
alert("text explaining that order is not cancelled")
document.myForm.action =3D "completescript.php"
//some form validating code here
Fr=E5n: Alex Varbola [mailto:a_varbola@h...]
Skickat: den 18 september 2002 03:27
Till: beginning php
=C4mne: [beginning_php] Multiple submit buttons
I have a form with 2 submit buttons at the end.
Cancel and Complete.
The cancel button cancels a order, closes a session, clearing all
variables. The other button submit validates the form and sends an
Does php allow multiple submit buttons?
At the moment both buttons do the same thing.
e.g. this does not seem to work
print "<input type=3D\"submit\" name=3D\"cancel\" value=3D\"Cancel\">";
print "<input type=3D\"submit\" name=3D\"complete\"
When you click the button do name or value get passed?
Message #2 by "Nikolai Devereaux" <yomama@u...> on Wed, 18 Sep 2002 10:49:50 -0700|
> if i was to do this i would set the type of the buttons to
> "button" and set
> onclick action to them specifying where to submit the form
> like this:
This all depends on preference. A lot of people don't want to introduce a
Also, you're requiring two different PHP scripts to handle the different
actions. I like to code my scripts such that each form contains all the
code required to process the input for that form... I think things would be
more disorganized if that core form processing logic was spread out among
Message #3 by "David Scott-Bigsby" <DScott-Bigsby@P...> on Wed, 18 Sep 2002 11:15:42 -0700|
> Also, you're requiring two different PHP scripts to handle
> the different
> actions. I like to code my scripts such that each form
> contains all the
> code required to process the input for that form... I think
> things would be
> more disorganized if that core form processing logic was
> spread out among other files.
Has anyone read any good articles on application architecture and PHP?
Nik suggests one model -- for each HTML form a PHP handler (or "brain"),
which handles multiple actions (e.g., update, cancel).
Another I've seen is one PHP handler for an entire process -- one
index.php generates multiple pages, handling the submitted output of one
to generate the next in the workflow.
A third is to have a handler which has no output except a redirect
header -- its logic drives a switchboard, sending the user to another
page to show the results.
I'm sure there are other variations...
Is one better than the others? Does it depend on the application?
Product Manager, Web Site and PEDN
The Leader in Secure XML e-Forms