Element.value = Can get to "explode" this after construction

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

The only way as far as i know to grab data from a PHP array through JS would be to use something like the example below.

var data = <?php echo json_encode($arrdata); ?>;

document.getElementById("element_1").value = data[cur_id];

I don’t exactly know how your going to set the current id needed so i put cur_id in as a placeholder.

Thank you Sgt!
To simplify things, the two-dimension array was first created on java script and filled later swapping a one-dimension array from php, thus no need to give php a variable; each temporary on php come with only 8 columns, so its manageable.

myArray[<?php echo $offset;?>][0] = “<?php echo $parts[0];?>”;
myArray[<?php echo $offset;?>][1] = “<?php echo $parts[1];?>”;
myArray[<?php echo $offset;?>][2] = “<?php echo $parts[2];?>”;

Thanks a lot !