Re: MULTIPLE SUBMIT BUTTONS

From: Date: Sat, 10 May 2003 18:03:17 +0000
Subject: Re: MULTIPLE SUBMIT BUTTONS
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-147132@lists.php.net to get a copy of this message
Thank you for some help but I am still having some problems: I am probably doing something stupid, but I can't seem to find what I am doing wrong: Here is a little bit of the code: FORM1.PHP: <TABLE cellpadding="0" cellpadding="0" border="0"> <TR> <TD width="500"></TD> <TD> <INPUT TYPE=IMAGE SRC="../../../IMAGES/EMPLOYEE_MNGR/BUTTON/SAVECLOSE1.GIF" NAME="SUBMIT1" VALUE="SUBMIT"> </TD> <TD WIDTH="5"></TD> <TD> <INPUT TYPE=IMAGE SRC="../../../IMAGES/EMPLOYEE_MNGR/BUTTON/SAVE1.GIF" NAME="SUBMIT2" VALUE="SUBMIT"> </TD> </TR> </TABLE> VERIFY1.PHP: echo $_POST['SUBMIT']; echo $SUBMIT; For some reason, nothing appears on the page: verify1.php. Any ideas? Thanks, Dale "Shawn McKenzie" <nospam@mckenzies.net> wrote in message news:20030510173856.14017.qmail@pb1.pair.com... > Good point. > > "Paul Chvostek" <paul+php@it.ca> wrote in message > news:20030510133127.A50889@mail.it.ca... > > > > On Sat, May 10, 2003 at 12:00:43PM -0500, Shawn McKenzie wrote: > > > > > > Depends on what you name your buttons. Easiest way is to name all of > them > > > the same and assign different values and then check that var name on the > > > next form. > > > > I'd have to disagree. I would think the easiest way is to name them all > > *different* things, so you can freely change the text in the buttons > > (for languages, etc.) without killing functionality. So: > > > > <input type=submit name=save_close value="Save & Close"> > > <input type=submit name=save_new value="Save & New"> > > <input type=submit name=save_redirect value="Save & Redirect"> > > <input type=submit name=save_only value="Save"> > > > > then in PHP: > > > > if ($_POST['save_close']) { > > ... > > } else > > if ($_POST['save_new']) { > > ... > > } else > > if ($_POST['save_redirect']) { > > ... > > } else > > if ($_POST['save_only']) { > > ... > > } > > > > p > > > > > > > > > > > > type=submit name=submit value=close > > > type=submit name=submit value=new > > > etc.. > > > > > > Next page, > > > > > > switch($_POST['submit']) { > > > case "close": > > > etc... > > > > > > HTH > > > -Shawn > > > > > > "Dale" <DaleHersh@hotmail.com> wrote in message > > > news:20030510165427.82269.qmail@pb1.pair.com... > > > > Hi, > > > > I have read the section in the online manual on how to access > variables > > > > outside of php, but I am still have problems with the current > situation: > > > > > > > > I have a form that has multiple submit buttons: > > > > > > > > 1. save & close > > > > 2. save & new > > > > 3. save & redirect > > > > 4. save > > > > > > > > Each of these buttons will need to call the same save function, but > after > > > > the data from the form has been saved, each button will have a unique > > > task. > > > > How do I access the name of the submit button in php. I have tried the > > > > following methods: > > > > > > > > $_POST['SUBMIT'] > > > > $SUBMIT > > > > > > > > and so far I have had no luck. I do have global variable turned on. > > > > > > > > Thanks, > > > > Dale > > > > > > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > Paul Chvostek <paul@it.ca> > > Operations / Abuse / Whatever > > it.canada, hosting and development > > http://www.it.ca/ > > > >

« previous php.general (#147132) next »