Re: CheckBoxes and Arrays

From: Date: Wed, 12 Sep 2001 05:55:52 +0000
Subject: Re: CheckBoxes and Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66998@lists.php.net to get a copy of this message
On 12-Sep-2001 Christopher William Wesley wrote: > On Tue, 11 Sep 2001, Ryan Stephens wrote: > >> Im trying to output a list of options, each with a checkbox named "ChkBox" > ... > > Name each checkbox "ChkBox[]" ... the brackets are the key. > > When the form is submitted, you'll have an array called $ChkBox that will > contain the data only from the checked checkboxes. You can loop over that > array pretty simply. > > for( $i = 0; $i < sizeof( $ChkBox ); $i++ ){ > print( $ChkBox[$i] . " was checked<br>" ); > // Delete the row from the database, etc ... > } > $p=array(); while (list($k,$v) = each($cbk)) { $p[]=$k; } $ids=implode("','", $p); $qry="DELETE FROM foo WHERE id IN ('$ids')"; mysql_query($qry); > Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#66998) next »