faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

129 of 195 people (66%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I present a form with two buttons - each doing a submit for different things (ie - log in or change password). Can I call PHP from an onclick.

Feb 18th, 2008 19:28
dman, Narendra Jain, Peter Boritz, http://www.ttnr.org


You can have as many buttons as you want in your form, each doing a
different function. 
You have to give names to each of the button and then check in the
script if that variable is set to ensure that you process the submitted
form correctly.
The buttom declaration could be:
<input name="action1" type=submit value=" My action 1">
Abive, action1 is the name of the button, which you have to check in
your script i.e. if $action1 is set or not.
if ($action1) {
   process_button1()
}
and so on..
Hope that helps..
Narendra Jain