phpjayx Posted December 2, 2012 Share Posted December 2, 2012 How do I get a PHP variable, called counter over to HTML or Javascript like below? <script type="text/javascript"> document.write("Total Hits :" + sessionStorage.counter); </script> Quote Link to comment https://forums.phpfreaks.com/topic/271473-getting-a-variable-from-php-to-html/ Share on other sites More sharing options...
Pikachu2000 Posted December 2, 2012 Share Posted December 2, 2012 Is this what you mean? <script type="text/javascript"> document.write("Total Hits :" + sessionStorage.<?php echo $counter; ?>); </script> Quote Link to comment https://forums.phpfreaks.com/topic/271473-getting-a-variable-from-php-to-html/#findComment-1396828 Share on other sites More sharing options...
phpjayx Posted December 3, 2012 Author Share Posted December 3, 2012 Ahh yes, that worked... Thanks. I'm new to this, I didn't know you could imbed PHP like that... Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/271473-getting-a-variable-from-php-to-html/#findComment-1397058 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.