Re: CheckBoxes and Arrays
| From: | Christopher William Wesley | Date: | Wed, 12 Sep 2001 01:00:24 +0000 |
| Subject: | Re: CheckBoxes and Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66976@lists.php.net to get a copy of this message | ||
On Tue, 11 Sep 2001, Ryan Stephens wrote:
> Im trying to output a list of options, each with a checkbox named "ChkBox"
...
Name each checkbox "ChkBox[]" ... the brackets are the key.
When the form is submitted, you'll have an array called $ChkBox that will
contain the data only from the checked checkboxes. You can loop over that
array pretty simply.
for( $i = 0; $i < sizeof( $ChkBox ); $i++ ){
print( $ChkBox[$i] . " was checked<br>" );
// Delete the row from the database, etc ...
}
~Chris /"\
\ / Pine Ribbon Campaign
Microsoft Security Specialist X Against Outlook
The moron in Oxymoron. / \ http://www.thebackrow.net