Re: multiple checkboxes

From: Date: Tue, 03 Aug 2004 13:26:48 +0000
Subject: Re: multiple checkboxes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192537@lists.php.net to get a copy of this message
From: "Robert Sossomon" <robert@gcnorris.com> > You need to do: > <input type=checkbox name="checkBoxGroup1" value="first"/> > <input type=checkbox name="checkBoxGroup2" value="second"/> > > Keeping the name the same makes them a RADIO button and you will only > get the last one. This is a valid solution, but it's really just easier to make them into an array like many others have suggested. Using this method, you would need to loop through all of the possible "checkBoxGroupX" values to see which ones were checked or get a list or count of them. Making them into an array makes it as simple as count($_POST['checkBoxGroup']) or implode(',',$_POST['checkBoxGroup']), etc... ---John Holmes...

« previous php.general (#192537) next »