PHP Not Working When Inside a Javascript <script> Tag
Hi. I'm brand new to PHP and am trying to see what it can do. I put a small page together that sort of looks like this:
Code:
<?php
echo '
-- some javascript code --
</script>
<script>
';
$file = fopen("Awards.csv","r");
$x = fgetcsv($file);
print_r ($x);
echo '
</script>
-- some more javascript code
-- some html code --
';
?>
Here's the thing. The PHP code only seems to work if I put it outside of the <script></script> tags. It's probably something I'm doing wrong, but all the reading I've done on PHP says it should work.
What I'm really trying to do is to get the contents of the file into a javascript array. That's probably something for a different thread.
If someone could tell me what I'm doing wrong and why the PHP code won't work, I'd appreciate it.
Thanks.