Hi
I cannot figure out how to import an array from PHP into Javascript
MyPHPcode is like this
<?php
$i=0;
While ($i < $num) {
$PHPvar= (" $PHPvar \" $Mystring[$i] \" , ");
$i++;
}
?>
The ouput of $Mystring is: "string1","string2","etc"," " (the
last empty string is added later on in the function:
This is exactly what Javascript expects in an array, however I get no
output in Javascript this way.
transfering data:
<INPUT TYPE= "hidden" ID= "PHP2JS" VALUE="<?php echo( $c);?> ">
javascript:
<script type="text/javascript">
var text=PHP2JS.value;
document.write(text);
myarray = new Array(text);
for etc.
</script>
When I replace the \" with nothing (in the PHP part) it works in
the - document write(text) - and all data is loaded into
myarray(0) but I need the " " .
does someone have a better idea?
Thanks
Frits
Netherlands
Frits v/d Laan
Biologische tuinplanten kwekerij
http://fvanderlaan.nl