In the header of my doc I am defining a email and password. I would like to user local storage. However I am having trouble loading items from localstorage into my php vars.
Here is my code.
<script>
localStorage.setItem('email', '<?php echo $_SESSION['email'];?>');
localStorage.setItem('password', '<?php echo $_SESSION['password'];?>');
</script>
<?php
$user_email = "<script>document.write(localStorage.getItem('email'));</script>";
$password = "<script>document.write(localStorage.getItem('password'));</script>";
define('XOAUTH_USERNAME', $user_email);
define('XOAUTH_PASSWORD', $password);
?>
<html>
<head></head>
<body></body>
</html>
I know that I am setting the localstorage right because I'm checking in chrome and both key and value are correct. I'm just have trouble passing the value of the keys into the define() of my php.
Thanks for the help!