Re: form submission logic

From: Date: Fri, 07 May 2004 19:11:02 +0000
Subject: Re: form submission logic
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-185676@lists.php.net to get a copy of this message
"Kim Steinhaug" <kim@steinhaug.com> wrote in message news:20040507184458.23039.qmail@pb1.pair.com... > Well, > > I would include another hidden field and name it something like "ACTION". > I would also include a checkbox on every item you want to do something with > like this : > > <input type=checkbox name="item[]" value="<?=$databaseID?>"> > > Then use javascript on your actions to set the action to whatever mode you > need, for example "delete". On the PHP side you get a very nice workflow now, as > you will recieve an array on all the items which are selected and you can > perform multiple tasks at once. Example, publish n articles in one go, or delete all > at once. I would not recommend using Javascript here because then you are reliant on the client having JS enabled. Just use different names for your submit buttons and then check them: if (isset($_POST['new'])) { ... } elseif (isset($_POST['delete'])) { ... } ...and so on Regards, Torsten > > Remember to valiudate the $_POST["item"] as an array! Remember, all the > values > in this array will be the onces you should $_POST["action"]. > > Have fun! > > -- > -- > Kim Steinhaug > ---------------------------------------------------------------------- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > ---------------------------------------------------------------------- > www.steinhaug.com - www.easywebshop.no - www.webkitpro.com > ---------------------------------------------------------------------- > > "Aaron Wolski" <aaronjw@martekbiz.com> wrote in message > news:007e01c4345a$c23b3e60$6501a8c0@AJW2... > > Hi all, > > > > Was wondering if someone had any idea's on this logic and if it'd work, > > before I tried to implement it: > > > > Within the <form></form> tags I have my buttons - Publish, Unpublish, > > New, Edit and Delete. > > > > Next I have a table of that displays a list of records from a database > > with a checkbox to select a particular record. > > > > Once a record has been "selected" they click one of the top buttons to > > perform their desired action. > > > > WILL this work OR do the buttons HAVE to go at the bottom? > > > > Thanks! Any help is appreciated. > > > > Regards, > > > > Aaron > > > >

« previous php.general (#185676) next »