2 buttons in a form ?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I would like to have 2 buttons in the same form and each button have an
different action.
by example:
One button is to "Preview the request"
The other is to "Confirm the request"

Thank you

Re: 2 buttons in a form ?

franck wrote:
Quoted text here. Click to load it

well have 1 button submit to a DB or pl file to "submit" the form, and
the other to store the information temporarily and spew it out in
pph/asp or cgi file and then that page has a submit...

Neo Human Calibrated for Gratification

Re: 2 buttons in a form ?

Sorry but my question was bad.

I have a form like this:

<form name="form1" method="post" action="send_email_groupe.php">
<textarea name="contenu" cols="100" rows="20"></textarea>
<input type="submit" name="Submit" value="Modifier">

You can see that there is only ONE action  possible for this form. It is

Then, I would like to have 2 actions into the same form with 2 buttons
inside (One to prewiew and the other to confirm).
I hope you anderstand me because my English is not very good.

How to do that.
Thank you.

Re: 2 buttons in a form ?

Quoted text here. Click to load it

So modify send_email_groupe.php to do different things depending on
which button was pressed (obviously you need to give the two buttons
different names).


"My theories appal you, my heresies outrage you,
 I never answer letters and you don't like my tie."  - The Doctor

Re: 2 buttons in a form ?

Thank you !!
I didn't know that the name of the button was trasfer as parameter to the
target URL.

Thank you, that's works.

Quoted text here. Click to load it

Re: 2 buttons in a form ?

Quoted text here. Click to load it

Try something along the lines of this:

<input type="submit" name="action" value="Preview the request" />
<input type="submit" name="action" value="Confirm the request" />

Only the value of the submit button the user has clicked will be sent along
with the other form data, so it's just a matter of checking in your script
code which value has been passed for the name you gave your submit button
(in the example, the form field "action").

Kim André Akerø
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

Site Timeline