howabout making the checkboxes an array i.e. <INPUT TYPE="checkbox" name="checkbox[<?php echo($row[0])?>]" VALUE="YES">
then when processing ... foreach($_REQUEST["checkbox"] as $checkbox) { ... } Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] ----- Original Message ----- From: anders thoresson <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, February 02, 2003 12:28 PM Subject: [PHP] processing form with unknown number of checkboxes, each with a unknown name. > Hi, > > I building a form which will be used to set access rights to different > parts of my web album. When editing the settings for each album, like the > albums name and wether or not everyone should be allowed to upload pictures > to it, I also present a list of checkboxes to the administrators. One > checkbox for each registred user. If checked, to user is allowed to view > the pictures, if not check, no pictures show. > > The checkbox part of the form I build uses this code: > > db_connect($dbuser, $dbpassword, $dbdatabase); > $query = "SELECT userid FROM members"; > $result = mysql_query($query); > while($row = mysql_fetch_array($result)) { > echo($row[0]); > ?> > <INPUT TYPE="checkbox" name="<?php echo($row[0])?>" VALUE="YES"> > > > But how do I process this form when saving the settings for the album? For > the forms I've built so far, I've known what information I can find in > $_REQUEST['']. But this time, I don't know how many checkboxes there are, > and what their names will be. How do I do this? > > Is the form ok, or is a bad form design the reason I can't figure out what > to form processing code should be? > > -- > anders thoresson > > -- > 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