Set Javascript Cookie, Access it With PHP
Posted: Tue Aug 17, 2010 10:43 am
<script language="JavaScript">
document.cookie = "scrwidth="+screen.availWidth;
</script>
<?php
echo $_COOKIE["scrwidth"];
?>
The first time i go to this page, it successfully sets the java cookie but doesn't echo the cookie contents with the following PHP code. I have to refresh the page for it to be echoed by PHP. What i want is to echo it the first time i get to this page without the need for refreshing. Any help, pliz!
document.cookie = "scrwidth="+screen.availWidth;
</script>
<?php
echo $_COOKIE["scrwidth"];
?>
The first time i go to this page, it successfully sets the java cookie but doesn't echo the cookie contents with the following PHP code. I have to refresh the page for it to be echoed by PHP. What i want is to echo it the first time i get to this page without the need for refreshing. Any help, pliz!