Thanks TTT,
You posted:
<script language="JavaScript">
function Get_Array()
{
My_array= new array()
<? for($b=0;$b<count($a);$b++) {
pritnt "My_array[$b]= $a[$b];";
}
?>
}
</script>
So as a newby I tried it out. I copied and pasted what you gave to my script and it didnt work....aaaarrrggggg hehe...
First the spelling "print " that was easy to see...
Then I found out that new array must be spelled "new Array" in the javascript...
Then found out that there was no ( \" ) inside the php print...
Once all this corrected it still didnt work 😃
My original post asked how to pass the array >>>
<?php
$a=array('a' => 'hello', 'b' => 'php', 'c'=> 'builders');
?>
Since the keys "a,b,c" are not found in your script this will never work...
To make it work the array must be changed or your script. I changed the array to >>>
<?php $a= array("hello","php","builders"); ?>
Now it works correctly aaarrgggg.... hehe
function Get_Array()
{
My_array= new Array()
<? for($b=0;$b<count($a);$b++) {
print "My_array[$b]= \"$a[$b]\";\n";
}
?>
document.write(My_array);
}
Thanks..... next time be aware I am a newby aaagggrrrr... hehe