Page 1 of 1

Making javascript variable a PHP variable

Posted: Wed Sep 12, 2007 10:56 pm
by elinews
I made this javascript, which is printing a js array, a php variable ($java) (took out the "<"s so it would display):

Code: Select all

<script type='text/javascript'>

document.write(photo[0])

</script>
I am then inserting that variable into another like this:

Code: Select all

$image="$dir/$java";
This is creating the source for the image. And of course it outputs the full javascript code instead of printing the array when it is called upon in $image.

My question is how do I get the array name to show instead of the javascript code? I'm thinking it must be done with a function() . . .

Posted: Wed Sep 12, 2007 11:02 pm
by feyd
I'm not following. How is $image being used? Javascript runs once the script has finished running.