Hello Experts, I can not pass javascript variable into php session. My code: function keepID(myform) { i = 0, inputs = document.myform.getElementsByTagName('input'); for(i=0;i<<?php echo $_SESSION['row'] ?>;i++) { if(document.myform.chkID.checked==true) { x=document.myform.chkID.value; } } } My checkboxes are moving in a loop: <input type="checkbox" name="chkID[]" id="chkID" value="<?=$rowSubjects['ID']?>" onClick="return keepID(this);"> Please help...
Can you click "View Souce" in web browser and look the JavaScript code that was generated after <?php echo $_SESSION['row'] ?> was done ? Does this php code was runned and any integer was passed into javascript code ?
I have clicked "View Souce" in web browser and look the JavaScript code that was generated after <?php echo $_SESSION['row'] ?>.This php code was runned and integer was passed into javascript code . Php variables are passing to javascript but dont know how to do vice versa. Thanks for your interest in it. Waiting for reply. Thank you.
Thanks for the reply. function keepID(myform) { i = 0, inputs = document.myform.getElementsByTagName('input'); for(i=0;i<<?php echo $_SESSION['row'] ?>;i++) { if(document.myform.chkID.checked==true) { x=document.myform.chkID.value; <?php $_SESSION['checkboxID'][$i] ?>=x;//My this line is not working } } } Please help..
Thanks for your patience.. My checked check boxes will be remain checked in php pagination .The right ids are coming from db with onclick event .I want to keep these ids into session.When pages reloaded respective checkboxes will be checked.The javascript values are not going to session. Any idea or suggestion would be appreciated... function keepID(myform) { i = 0, inputs = document.myform.getElementsByTagName('input'); for(i=0;i<<?php echo $_SESSION['row'] ?>;i++) { if(document.myform.chkID.checked==true) { x=document.myform.chkID.value; <?php $_SESSION['checkboxID'][$i] ?>=x; } } } Thanks again Please help..