jokerbla Posted October 3, 2009 Share Posted October 3, 2009 <script type="text/javascript"> <-- <?php echo ("average = $average;"); ?> // --> document.write(average); document.write("average"); </script> I want to transfer the $average from PHP to average from javascript, but this isn't working. Neither the value of average, nor the string "average" shows up at the end. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
jokerbla Posted October 3, 2009 Author Share Posted October 3, 2009 This doesn't work either. :-\ <script type="text/javascript"> var average=<?php echo($average) ?>; </script> Quote Link to comment Share on other sites More sharing options...
cags Posted October 3, 2009 Share Posted October 3, 2009 <script type="text/javascript"> var average = <?php echo $average; ?>; document.write(average); </script> Works fine for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.