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" <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php