for( $i=0; $i<3; $i++ ) { if( isset($chkAuthStatus[$i]) ) { do something } }
-----Original Message----- From: Matt C [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 03, 2001 10:17 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Check Boxes/UPDATE I am sorry but I still really don't get it :( How do I do the array thing? >-----Original Message----- >From: Jason G. [mailto:[EMAIL PROTECTED]] >Sent: 03 October 2001 12:12 >To: Matt C; [EMAIL PROTECTED] >Subject: Re: [PHP-DB] Check Boxes/UPDATE > > >Matt, > >Assuming that you have a variable number of records being displayed out of >the database: > >As you write out the HTML, give each checkbox a name containing the ID# of >the record that is being written out. Ex: ><input type="check" name="chkAuthStatus_1203" checked> ><input type="check" name="chkAuthStatus_1204" checked> ><input type="check" name="chkAuthStatus_1205" checked> Note that you can use arrays when naming your form elements -- isn't PHP wonderful :). Thus you can have: <input type="check" name="chkAuthStatus[0]" checked> <input type="check" name="chkAuthStatus[1]" checked> <input type="check" name="chkAuthStatus[2]" checked> ...etc This simplifies the code somewhat as you can now loop through the elements of the array $chkAuthStatus to find out whether it is checked or not. regards -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]