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> 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> 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! 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
Archived
This topic is now archived and is closed to further replies.