A.A. PEACE A.A. PEACE - 1 year ago 115
PHP Question

assign a php variable to a sessionStorage var

I am trying to set a php variable value to a HTML5 sessionStorage. Is this feasible? Check my code below:

<script>sessionStorage.username = </script><php echo $_GET["user"]; ?>

Thank you in advance

Answer Source

Try this:

    sessionStorage.username = '<?php echo $_GET["user"]; ?>';

Code edited

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download