heyyyyyyy i got the solution for this !!(after spending whole 
day...........)

in my code,  javascript was not accepting the statement :

document.subj_frm.chk_id[i].checked=true

cos in php script i was using :
<input type=checkbox name=chk_id[] value=".$row["subj_id"]."> </td>

i changed the javascript code to :

var max = document.forms[0].elements.length ;
for(i=3; i<=max; i=i+4)
{
   document.forms[0].elements[i].checked=true
}

value of "i" initialised to 3 and incremented with 4 as per requirement of 
my script. since 3rd,  7th, 11th .... elements are checkbox elements in my 
form. its little bit hard coded. but could solve the conflict problem for 
php array and javascript.

i got the clue from : http://www.php.net/manual/en/language.types.array.php

thanks to php.net !!!!
smita.


>From: To: "Smita Manohar" , Subject: Re:[PHP-DB] php and javascript Date: 
>Thu, 26 Sep 2002 8:17:39 +0300
>
>hy, if you have found the answer plz send me a copy... i'm having the same 
>type of problems... I want to modify or to create a new select option when 
>someone clicks a button. 1. I extract some values from a database 2. i want 
>when someone clicks a button, in the same page, to load other values from 
>the database and put them there
>
>it's a sort of dynamic loading ... thanks for reading and i will help you 
>if could solve this problem.. the part with inserting values from database 
>to the form is done but the rest of the part is done in a javascript 
>function that does not works...
>
> > > From: "Smita Manohar" > Date: 2002/09/25 Wed PM 06:20:48 GMT+03:00 > 
>To: [EMAIL PROTECTED] > Subject: [PHP-DB] php and javascript > > 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, > > > 
>onclick="javascript : func_select_all()"> > > which when clicked invokes 
>function to select all checkboxes. > > the function func_select_all has 
>been defined in the > as, > > > the phpscript where i print checkboxes is, 
> > > while ($row = mysql_fetch_array($result)) > { > . > . > . > echo " > > 
>value=".$row["subj_id"]."> "; // 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 " > > 
>value=".$row["subj_id"]."> "; > > 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 > smita. > > 
> > > _________________________________________________________________ > 
>MSN Photos is the easiest way to share and print your photos: > 
>http://photos.msn.com/support/worldwide.aspx > > > -- > PHP Database 
>Mailing List (http://www.php.net/) > To unsubscribe, visit: 
>http://www.php.net/unsub.php > > Free Email Account at www.flash.ro

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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

Reply via email to