Try something like this: <INPUT type="checkbox" name="<?php echo( $row['name'] ) ; ?>" value="1" <?php echo( $row['homeno'] == "0" ? "" : "checked" ) ; ?> >
(value is a dummy value - HTML will POST the name=value pair only if checked.) HTH Ignatius ____________________________________________ ----- Original Message ----- From: "Chris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 09, 2002 11:03 PM Subject: [PHP-DB] php -> checkboxes -> mysql > Greetings, > > I am just starting with php and need some help/code example for > setting checkbox values from mysql. My setup is the following: > > The mysql database holds data and checkbox values in respective columes. > For example > > name address phone homeno workno pagerno > Chris xxxx 555-1212 1 0 0 > > 1 = checkbox should be checked > 0 = checkbox should not be checked > > On the webpage side I would have name, address and phone number textboxes, > and then 3 checkboxes for the "homeno", "workno" and "pagerno". > > When the page loads I would like to have the checkboxes be automatically > checked or left uncheck based on the mysql query to the db. I do not want > to do any grouping or anything, just query mysql for the homeno value, set > it, then check the workno value, set it, etc.. > > Any help is GREATLY appreciated. > Chris > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php