RE: [PHP-DB] Check Boxes/UPDATE

From: Date: Wed, 03 Oct 2001 07:59:57 +0000
Subject: RE: [PHP-DB] Check Boxes/UPDATE
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12957@lists.php.net to get a copy of this message
>-----Original Message----- >From: Jason G. [mailto:blair@nb.net] >Sent: 03 October 2001 12:12 >To: Matt C; php-db@lists.php.net >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

« previous php.db (#12957) next »