Re: Hide div using cookie if page has been already loaded today?
[quote="dflynn":2ah4p5sf]I would suggest using PHP for this. That way, if the user is new it can be generated on the spot. If not, then it will not be executed in the html and just be hidden.
[code:2ah4p5sf]
if( isset($_COOKIE['myCookie'])){
//Nothing will happen because the Cookie is set. If not it will go to else:
}else{
echo <div class="myDiv">This content only appears if the Cookie called myCookie is set in the user's browser.</div>
}
[/code:2ah4p5sf]
Something like that should work before your headers are loaded.[/quote:2ah4p5sf]
Heeey, thanks for idea!!

Well, I currently have this in my BODY, but it wont work

[code:2ah4p5sf]
<?php
if(isset($_COOKIE['cookiename']))
{ echo "cookie set";
}
else
{ echo
?>
<div id="autoload">
Cookie not set
</div>
<?php
;}
?>
<?php
setcookie("cookiename", "someValue", time()+3600);
?>
[/code:2ah4p5sf]
And when I view it in browser, and then refresh no matter how many times I get "Cookie not set".
What am I doing wrong?