I'm having problems with cookies and PHP and I'm not sure how to solve them. I've been working on a user tracking system for our site and I need to have the site remember them after they close their browser then come back. The only way I can think to do that is with cookies. I need to have PHP set a temp cookie on the first page then on the second page have it see the temp cookie and set it with an ID that will follow them on our site for a month or so.
the simple code I've written to try to do this <?php if(!isset($_COOKIE['userInfo'])){ setcookie("userInfo","temp",time()+60*60*24*30,"/","faxonautoliterature.com",0); print "settemp"; }else{ if($_COOKIE['userInfo']=="temp"){ $_COOKIE['userInfo']="userID"; print "$_COOKIE['userInfo']"; //having trouble here, it says undefined index } } ?> this is just for my use... basically call the page once and it'll set a temp cookie then call another page with the same script and it'll see the temp cookie and set it with a different variable. Thoughts? I'm using IE 6 to test this little bit. Thanks!