Re: determine how many checkboxes are selected.

From: Date: Tue, 26 Aug 2003 05:29:49 +0000
Subject: Re: determine how many checkboxes are selected.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160722@lists.php.net to get a copy of this message
First count the number of entries($count) to be displayed in the page. Accordingly assign the names for($i=0;$i< $count;$i++) { $chkval="chkv".$i; $chkfun="chkf".$i; echo "<input type=hidden name=$chkval value=off>"; echo "<input type=checkbox name="chkname".$i onclick=$chkfun()> "; //display record $i echo "<script language=JavaScript> function $chkfun() { if(document.forms[0].$chkval.value=='off') document.forms[0].$chkval.value='on'; else document.forms[0].$chkval.value='off'; }</script>"; } and upon subbmitting the form you can determine the checked entries. -murugesan ----- Original Message ----- From: "Angelo Zanetti" <binc2@ctech.ac.za> To: "Php-General@Lists.Php.Net" <php-general@lists.php.net> Sent: Tuesday, August 26, 2003 10:36 AM Subject: [PHP] determine how many checkboxes are selected. > > > Hi I have a tabel that gets populated dynamically from a DB query. Each row > is a seperate record and they all have a checkbox. I want to put a > button/image @ after the table and when it is click ed to determine which > checkboxes have beeen selected. I also name the checkboxes dynamically with > chk being the prefix and the record ID the suffix eg record 56: chk56 would > be the name of that particular checkbox. > > If anyone could help with this design issue I would appreciate it! > Or any advice will be great as well. > > angelo > > TIA > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#160722) next »