Re: Form Processing - Multiple inputs of the same name

From: Date: Fri, 31 Jan 2003 19:20:49 +0000
Subject: Re: Form Processing - Multiple inputs of the same name
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133816@lists.php.net to get a copy of this message
Change the name of your checkboxes in your HTML to something like: name="DeleteIDs[]" This will make it an array, and you can access all the elements like $_POST['DeleteIDs'][0] etc. (This should really be in a FAQ somewhere...) -- tracy On 1/31/03 11:17 AM, "Mike Potter" <mike@mikenbob.com> wrote: > Is it possible to pass an group of input boxes of the same name, then get > the values of all the checked boxes or filled out textboxes? > How do I get ALL the IDs passed. Right now it only passes the last ID. Do > I really have to give them all unique names? > > For example... > > <html> > <head> > </head> > <body> > <form action="testform.php" method="post"> > <input type="checkbox" value="0" > name="DeleteIDs"></input> Jon Smith<br> > <input type="checkbox" value="1" > name="DeleteIDs"></input> David Callow<br> > <input type="checkbox" value="2" > name="DeleteIDs"></input> Peter Parker<br> > . > . > . > <input type="submit" value="Delete Users"> > </form> > </body> > </html> > > This list of DeleteIDs will be build dynamically. I want the user to be > able to check the boxes they want to delete and pull the IDs on the posted > page. > > How do I get ALL the IDs passed. Right now it only passes the last ID. > > Thanks, > > Mike > > -- Tracy F. Rotton tracy@taupecat.com http://www.taupecat.com/ "... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat." -- Lisa Simpson, "Lisa the Greek"

« previous php.general (#133816) next »