Can't read from cookie until second load?
Posted: Wed Apr 25, 2007 7:45 pm
I'm using GET to set cookies such as index.php?audio=1&bandwidth=2. The header file sets a cookie per each GET in the url. However the page does not read the cookie initially and requires a reload to correctly display the cookie's value.
My files are as so...
1.) header.php
2.) header-cookies.php (included at bottom of header.php and used to process GET in url)
3.) index.php (this loads last and is the page initially requested)
An example of setting a cookie for index.php?audio=1 would be...
What am I be doing wrong?
My files are as so...
1.) header.php
2.) header-cookies.php (included at bottom of header.php and used to process GET in url)
3.) index.php (this loads last and is the page initially requested)
An example of setting a cookie for index.php?audio=1 would be...
Code: Select all
if ($_GET['audio'] == "0") {setcookie('audio','0',time()+2592000,'/');}
else if ($_GET['audio'] == "1") {setcookie('audio','1',time()+2592000,'/');}