Forum Moderators: coopster
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...
if ($_GET['audio'] == "0") {setcookie('audio','0',time()+2592000,'/');}
else if ($_GET['audio'] == "1") {setcookie('audio','1',time()+2592000,'/');}
What might I be doing wrong?
- John
From the PHP website:
Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires. Expire time is set via the expire parameter. A nice way to debug the existence of cookies is by simply calling print_r($_COOKIE);.
Try reloading the page when you set the cookie.
dc