Jump to content

Help Checking for existing cookie.


UrbanDweller

Recommended Posts

Hey,

 

I have just started using cookies and have got the basic idea of creating and accessing the simple cookies but now I am wanting to be able to check if a cookie already exists on the users computer before overwriting the current one.

 

<?php
if(!isset($_COOKIE['testCookie'])){
setcookie("TestCookie",
		 "username",
		 time() + (24 * 60)
		 )	
}
?>
<html>....</html>

 

At the moment my page just doesn't get past this piece of code any ideas?

 

Cheers

 

Link to comment
https://forums.phpfreaks.com/topic/262283-help-checking-for-existing-cookie/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.