beennn Posted June 7, 2013 Share Posted June 7, 2013 (edited) Here's what I've tried: <script> <? for ($i = 0; $i < sizeof($result_array); $i++) { ?> document.write('<? echo $i ?>'); <? } ?> </script> and <script> <? for ($i = 0; $i < sizeof($result_array); $i++) { ?> document.write('<? $i ?>'); <? } ?> </script> I've also tried just using JavaScript with the PHP variable embedded but still not luck. Any ideas? EDIT: Turns out I just needed to use <?php instead of <? Edited June 7, 2013 by beennn Link to comment Share on other sites More sharing options...
niche Posted June 7, 2013 Share Posted June 7, 2013 this will work $str = $_SESSION['first_10_flag'];echo '<script type="text/javascript">';echo 'alert("' . $str . '");';echo '</script>'; w/ the php tags Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now