News

Log In Sponsors
Partner Sites
Indonesian food - mi goreng by Indofood




Problem with creating cookie and showing/hiding div based on



Hi there, I am trying to set a cookie on html page with php code, which if cookie is not yet set shows content of a specific Div on that page (in this case it's div called Autoload). But after it's set (which is on next page refresh or reload) I want it to do nothing. I came up with following code, but it wont work... It always displays Div content even if the cookie has been set (or probably because I haven't set it properly). So what I need is: User goes to page, Div content is shown, then on next refresh/reload Div is not shown anymore. What am I doing wrong? Here is the code I've put in the BODY of html page: [code:2jfo1yjr]<?php if(isset($_COOKIE['imekukija'])) { } else { echo ?> <div id="autoload"> <script src="lightbox/prototype.js" type="text/javascript"></script> <script src="lightbox/scriptaculous.js?load=effects" type="text/javascript"></script> <script src="lightbox/lightbox.js" type="text/javascript"></script> <a href="http://www.webmaster-talk.com/images/index_open.jpg" rel="lightbox" id="img"></a> </div> <?php } ?> <?php setcookie("imekukija", "nekiValue", time()+3600); ?>[/code:2jfo1yjr]

Click here to read the whole forum topic