Re: Checkboxes

From: Date: Fri, 15 Aug 2003 18:50:27 +0000
Subject: Re: Checkboxes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159749@lists.php.net to get a copy of this message
> It could be a solution but only working with a few items. My list(s) > will be filled up with hundreds of items grabbed automatically out of > another MySQL table... would it help too? Maybe naming the check > boxes with each item own ID... anyone? What you could do is this: $query = "SELECT field_name FROM table" $result = mysql( $dbname, $query ); while( $dataRow = mysql_fetch_assoc( $result )) { echo '<input type="checkbox" name=checkboxes[] value="' . $dataRow['field_name'] . '">'; } On submission, all your checboxes will be here: $_POST['checkboxes'] and you can iterate through that to see what fields/checkboxes were set. No fuss, no muss and no billion if( isset( $checkbox )). Chris

« previous php.general (#159749) next »