Array of CheckBoxes

From: Date: Wed, 26 Jun 2002 02:38:03 +0000
Subject: Array of CheckBoxes
Groups: php.general 
Request: Send a blank email to php-general+get-103887@lists.php.net to get a copy of this message
Hi all. I have a form in which I must add a set of check boxes at the bottom. Once the form is passed away, the information of the checked boxes should be inserted into a DB. The thing is that I don’t like to use ‘tons’ of “if” statements ‘cause it will have way too many check boxes… Is there any way of creating an Array which holds TRUE for check boxes that where selected and NULL for the ones leaved clear? The final table with the data stored should look like this: +---------+-----------------+-----------+-----------+-----------+------- -----+-----------+ | userid | date | option1 | option2 | option3 | option4 | option5 | +---------+-----------------+-----------+-----------+-----------+------- -----+-----------+ | 1 | 2002-06-25 | true | true | false | false | true | | 2 | 2002-06-25 | false | true | true | false | false | | 2 | 2002-06-25 | true | false | false | true | true | +---------+-----------------+-----------+-----------+-----------+------- -----+-----------+ Haw can this be achieved? If no can do, I will have to do if… else if… else if… else if… and way too far down the page… else. Thanks in advance, <mailto:webmaster@icaam.com.ar> Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621

« previous php.general (#103887) next »