Hi.
I have an array on php, which is available to javascript:
document.getElementById(“element_1”).value = “<?php echo $arrdata[3][0]; ?>”;
(noted the number 3 ? I need to put a javascript variable instead, 0,1,2 etc.)
I need this to be dynamic, so i have this javascript variable $curr added to dynamically construct the php part
var $mystr = ‘<’ + “?” + “php” + " echo $arrdata[" +$curr+ ‘][0]; ?>’;
Tried several ways:
document.getElementById(“element_1”).value = ‘"’+$mystr+‘"’;
or
document.getElementById(“element_1”).value = $mystr;
but still $mystr is not “expanded”, so my control gets:
“<?php echo $arrdata[1][0]; ?>”
as a value, instead of the value from the array, which i insist, is available thrugh “<?php echo $arrdata[3][0]; ?>” for example.
How should I construct the value part to embed javascript $curr variable?
Any help greatly appreciated.
Carlos