simple checkbox / $_GET question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iG9
Forum Commoner
Posts: 38
Joined: Fri Jul 18, 2008 2:11 pm

simple checkbox / $_GET question

Post by iG9 »

I'm trying to let people check multiple items that are being retrieved from a database to generate checkboxes. All the checkboxes have the same name. They are passed back along with other form data to the same page for processing. So now in the URL there are potentially multiple instances of the same variable=value, with different values. If the script wants to do a certain action on each variable, how does it tell them apart, or even see more than one as it seems it would just go with whatever value was passed last?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: simple checkbox / $_GET question

Post by Burrito »

you need to create the checkbox as an array

Code: Select all

 
<input type="checkbox" name="myCheck[]">
 
iG9
Forum Commoner
Posts: 38
Joined: Fri Jul 18, 2008 2:11 pm

Re: simple checkbox / $_GET question

Post by iG9 »

Thanks.
Post Reply