Re: MULTIPLE SUBMIT BUTTONS

From: Date: Sat, 10 May 2003 17:39:04 +0000
Subject: Re: MULTIPLE SUBMIT BUTTONS
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-147131@lists.php.net to get a copy of this message
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 (#147131) next »