1) The example you have shown should work. Take a look at the foreach controle structure. (Link at bottom of mail.) 2) You cannot assign a value to a checkbox. It can only be set by the "checked" keyword (ie: <input type="checkbox" name="foo" checked>.) 3) The value of a checked checkbox is "on". If a checkbox is not checked it will not be passed to you by the clients browser. So if you where wondering why you could not get the value of some of the checkboxes, then that was why. 4) If you don't have to give the user a more thorough description then why not make a multiselect select box instead.
Example on a multiselect selectedbox <select name="foo[]" size=20 multiple> <option value="bar1">desc</option> <option value="bar2" selected>desc</option> ... </select> The above selectbox will display 20 rows in the box and if there is more than 20 selections you will be able to scroll it. You can get more information at: http://www.php.net/manual/en/control-structures.foreach.php http://www.php.net/manual/en/language.variables.external.php _________________________________________________ Marcus Rasmussen ------------------------------------------------------------- On 24-04-02 at 15:19 Liam MacKenzie wrote: ------------------------------------------------------------- >Hi all, > >I have a form, with about 40 checkboxes, I want to write a PHP document >that >processes the submission and displays the values of the checkboxes that >were >checked. >Pretty basic stuff, I've tried a few different things, some work but >display >"Array" at the top of the list of values. > > ><Snippet of HTML> ><td> ><input type="checkbox" name="games[]" value="Counter-Strike"> ></td> ><td>Counter-Strike</td> ><td> ><input type="checkbox" name="games[]" value="Total Annihilation"> ></td> ><td>Total Annihilation</td> ></tr> ></Snippet of HTML> > > > ><Snippet of PHP> >while ( $element = each( $games ) ) >{ > echo $element["value"]; > echo "<br>"; >} ></Snippet of PHP> > > > >I tried this too, it gave the same results as the above... > > > >if (is_array($games)) { > for ($z=0;$z<count($games);$z++) { > echo "$games[$z]<BR>"; > } >} >else { > echo "$games"; >} > > >I'm missing something real stupid, please help me out > >Thanks, >Liam > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php