hii all,
in my php script, im havin one form, in which having checkboxes. values for 
which are coming from database, and i want to do some action for  checked 
vales. so i create array of that checkbox.
now i want to include one link for "Check All" which helps user to check all 
boxes in single click. since that form is too big, i dont want to reload the 
entire page. hence trying to use javascript for this stuff.

i've included one more check box for "Check All"
which is used as,
<INPUT type="checkbox" name="chk_select_all"                                 
                               onclick="javascript : func_select_all()">

which when clicked invokes function to select all checkboxes.

the function func_select_all has been defined in the <head> </head>
<script language=javascript>
function func_select_all()

        for(i=0;i<num_rows ; i++)   //num_rows variables have been defiened 
in the beginning.
     for(i=0;i<=num_rows; i++)


the phpscript where i print checkboxes is,

while ($row = mysql_fetch_array($result))
     echo " <td align=center><input type=checkbox name=chk_id[]              
                     value=".$row["subj_id"]."> </td> "; // values for which 
are coming from database

now in the above line (in phpscript) name of the checkbox is chk_id[] i 
should define it as array, since i have to pass array of all checked values. 
but when i select the check box named,  chk_select_all (see above code) it 
goes to the function defined in javascript func_select_all but there it 
gives error for checkbox name, since i've defined it as an array(in 
phpscript), instead if in my phpscript i dont specify it as an array, ie,
  echo " <td align=center><input type=checkbox name=chk_id                   
                value=".$row["subj_id"]."> </td> ";

javascript function works fine, and it selects all checkbox values. but in 
that case, my php code doesn't work fine, since checkbox value is not array, 
it cant remeber checked values.

can anyone pls suggest something? of can give other solution to "check all" 
values without reloading the page

thanks in advance

MSN Photos is the easiest way to share and print your photos: 

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to