p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: 3 submit buttons


Message #1 by "Yao Minfeng" <mscxmy@c...> on Thu, 26 Jul 2001 13:14:29 +0100
Dear friends,



Can I have 3 submit buttons in a form, and each of them have different 

actions?



Cheers





----------------------------------------------



Yao Minfeng



School of Computing

University of Leeds

Leeds, United Kingdom



Message #2 by LUIS M MORALES <luismorales@j...> on Thu, 26 Jul 2001 10:04:15 -0400

Yeah...



Only change the value of submit to take any action.



Best regards,



Luis Morales



Yao Minfeng wrote:



> Dear friends,

>

> Can I have 3 submit buttons in a form, and each of them have different actions?

>

> Cheers

>

> ----------------------------------------------

>

> Yao Minfeng

>

> School of Computing

> University of Leeds

> Leeds, United Kingdom

>

>

Message #3 by "Hermawan Haryanto" <hermawan@h...> on Fri, 27 Jul 2001 01:54:35 +0700
Of coz you can,

lets do it like this :

<?php

$cmdSubmit1="I Hate U";

$cmdSubmit2="I Luv U";

$cmdSubmit3="I Dont Care";

if(trim($action)==$cmdSubmit1){



}elseif(trim($action)==$cmdSubmit2){



}elseif(trim($action)==$cmdSubmit3){



}

?>

<form method="post">

  put your fields here with those three submit button,

example of button :

<input type="submit" name="action" value="<?=$cmdSubmit1"> <!--//THIS LINE

WILL GIVE YOU THE FIRST BUTTON//-->

</form>



Thanks

Hermawan Haryanto

----- Original Message -----

From: "Yao Minfeng" <mscxmy@c...>

To: "beginning php" <beginning_php@p...>

Sent: Thursday, July 26, 2001 7:14 PM

Subject: [beginning_php] 3 submit buttons





Dear friends,



Can I have 3 submit buttons in a form, and each of them have different

actions?



Cheers





----------------------------------------------



Yao Minfeng



School of Computing

University of Leeds

Leeds, United Kingdom

Message #4 by Erwin Kodiat <Erwin.Kodiat@m...> on Fri, 27 Jul 2001 09:22:34 +0800
I guess you have to do some JavaScript-ing to make it possible, for each

button change the action respectively



Erwin Kodiat

Mitrais Software Development Center

Bali, Indonesia

Tel: +xx xxx xxxxxx

Fax: +xx xxx xxxxxx

http://www.mitrais.com 



This transmission is for the intended addressee only and is confidential

information.  If you have received this transmission in error, please delete

it and notify the sender.  The contents of this E-mail are the opinion of

the writer only and are not endorsed by MROnly.com Pte Ltd unless expressly

stated otherwise. 



-----Original Message-----

From: LUIS M MORALES [mailto:luismorales@j...]

Sent: Thursday, July 26, 2001 22:04

To: beginning php

Subject: [beginning_php] Re: 3 submit buttons







Yeah...



Only change the value of submit to take any action.



Best regards,



Luis Morales



Yao Minfeng wrote:



> Dear friends,

>

> Can I have 3 submit buttons in a form, and each of them have different

actions?

>

> Cheers

>

> ----------------------------------------------

>

> Yao Minfeng

>

> School of Computing

> University of Leeds

> Leeds, United Kingdom

Message #5 by Jorge Cordero <jorge@d...> on Thu, 26 Jul 2001 22:22:59 -0500
I guess you have to be creative to solve this.

I guess what you want to acomplish is to send the form to three diferent

pages.

thats easy achive with one button and three chekboxes



If you really mean three diferent actions example:submit , erase, other to

go back. just change the value of the buttons as Luis have mentioned.

you need to specify the the function you want to call something like this

<type="button"ValueonClick="DoSomething( )">



Saludos

Jorge

----- Original Message -----

From: "Erwin Kodiat" <Erwin.Kodiat@m...>

To: "beginning php" <beginning_php@p...>

Sent: Thursday, July 26, 2001 8:22 PM

Subject: [beginning_php] Re: 3 submit buttons





> I guess you have to do some JavaScript-ing to make it possible, for each

> button change the action respectively

>

> Erwin Kodiat

> Mitrais Software Development Center

> Bali, Indonesia

> Tel: +xx xxx xxxxxx

> Fax: +xx xxx xxxxxx

> http://www.mitrais.com

>

> This transmission is for the intended addressee only and is confidential

> information.  If you have received this transmission in error, please

delete

> it and notify the sender.  The contents of this E-mail are the opinion of

> the writer only and are not endorsed by MROnly.com Pte Ltd unless

expressly

> stated otherwise.

>

> -----Original Message-----

> From: LUIS M MORALES [mailto:luismorales@j...]

> Sent: Thursday, July 26, 2001 22:04

> To: beginning php

> Subject: [beginning_php] Re: 3 submit buttons

>

>

>

> Yeah...

>

> Only change the value of submit to take any action.

>

> Best regards,

>

> Luis Morales

>

> Yao Minfeng wrote:

>

> > Dear friends,

> >

> > Can I have 3 submit buttons in a form, and each of them have different

> actions?

> >

> > Cheers

> >

> > ----------------------------------------------

> >

> > Yao Minfeng

> >

> > School of Computing

> > University of Leeds

> > Leeds, United Kingdom

>

Message #6 by "Yao Minfeng" <mscxmy@c...> on Fri, 27 Jul 2001 10:14:25 +0100

Dear Erwin Kodiat, Luis Morales,



I really appreciate your suggestion.



I've tried to use JavaScript before, but failed. I think I have 2 problems:



1) the buttons should be set to "type=Submit" or "type=button" ?



2) in the JavaScript, should I say

    onClick=" form_name.ACTION = php_script1.php;

                     ..."

    ?



It seems that it doesn't work for me.





3) Luis Morales said to change the value of submit to take any action, could

you please give me an example?







Thanks again for you help.





----------------------------------------------



Yao Minfeng



School of Computing

University of Leeds

Leeds, United Kingdom





Message #7 by "Yao Minfeng" <mscxmy@c...> on Fri, 27 Jul 2001 10:20:59 +0100
Dear Jorge,



> I guess what you want to acomplish is to send the form to three diferent

pages.

That's exactly what I want to do.



> thats easy achive with one button and three chekboxes

but it seems I can not change the value of the ACTION attribute.





----------------------------------------------



Yao Minfeng



School of Computing

University of Leeds

Leeds, United Kingdom





Message #8 by Erwin Kodiat <Erwin.Kodiat@m...> on Fri, 27 Jul 2001 17:58:51 +0800
<input type=button>



Erwin Kodiat

Mitrais Software Development Center

Bali, Indonesia

Tel: +xx xxx xxxxxx

Fax: +xx xxx xxxxxx

http://www.mitrais.com 





-----Original Message-----

From: Yao Minfeng [mailto:mscxmy@c...]

Sent: Friday, July 27, 2001 17:14

To: beginning php

Subject: [beginning_php] Re: 3 submit buttons







Dear Erwin Kodiat, Luis Morales,



I really appreciate your suggestion.



I've tried to use JavaScript before, but failed. I think I have 2 problems:



1) the buttons should be set to "type=Submit" or "type=button" ?



2) in the JavaScript, should I say

    onClick=" form_name.ACTION = php_script1.php;

                     ..."

    ?



It seems that it doesn't work for me.





3) Luis Morales said to change the value of submit to take any action, could

you please give me an example?







Thanks again for you help.





----------------------------------------------



Yao Minfeng



School of Computing

University of Leeds

Leeds, United Kingdom





Message #9 by Jorge Cordero <jorge@d...> on Fri, 27 Jul 2001 10:37:52 -0500
if(!$company AND !$person){

echo("Your info is incomplete please correct");

echo("<br><BR><input type='button' name='corre' value='Corregir'

onClick='self.history.back();'>");

exit();

}

please explain what you want to do you want ot redirect to three diferent

places or which actio would you like to take???



Jorge Cordero



----- Original Message -----

From: "Erwin Kodiat" <Erwin.Kodiat@m...>

To: "beginning php" <beginning_php@p...>

Sent: Friday, July 27, 2001 4:58 AM

Subject: [beginning_php] Re: 3 submit buttons





> <input type=button>

>

> Erwin Kodiat

> Mitrais Software Development Center

> Bali, Indonesia

> Tel: +xx xxx xxxxxx

> Fax: +xx xxx xxxxxx

> http://www.mitrais.com

>

>

> -----Original Message-----

> From: Yao Minfeng [mailto:mscxmy@c...]

> Sent: Friday, July 27, 2001 17:14

> To: beginning php

> Subject: [beginning_php] Re: 3 submit buttons

>

>

>

> Dear Erwin Kodiat, Luis Morales,

>

> I really appreciate your suggestion.

>

> I've tried to use JavaScript before, but failed. I think I have 2

problems:

>

> 1) the buttons should be set to "type=Submit" or "type=button" ?

>

> 2) in the JavaScript, should I say

>     onClick=" form_name.ACTION = php_script1.php;

>                      ..."

>     ?

>

> It seems that it doesn't work for me.

>

>

> 3) Luis Morales said to change the value of submit to take any action,

could

> you please give me an example?

>

>

>

> Thanks again for you help.

>

>

> ----------------------------------------------

>

> Yao Minfeng

>

> School of Computing

> University of Leeds

> Leeds, United Kingdom

>




  Return to Index