Page 1 of 1
How to test if cookie is already set?
Posted: Sun May 23, 2004 9:53 am
by ljCharlie
I have a page that when the user logged in, I set the cookie. However, I couldn't figure out how to test if the cookie is already set. If the cookie is alredy set for that user, then do not set the cookie again.
Any suggestion is much appreciated.
ljCharlie
Posted: Sun May 23, 2004 9:56 am
by kettle_drum
Code: Select all
if(!isset($_COOKIE)){
set_cookie();
}
Posted: Sun May 23, 2004 10:03 am
by ljCharlie
Thank you very much...I'll give that a try. I thought it would be something harder.
ljCharlie
Posted: Sun May 23, 2004 10:04 am
by ljCharlie
Oh, by the way, one more question. Is the $_COOKIE something I manually have to declared or is that part of the PHP reserved word to test if cookie is set?
ljCharlie
Posted: Sun May 23, 2004 11:51 am
by feyd
predefined superglobal
Posted: Sun May 23, 2004 12:06 pm
by tim
Code: Select all
<?php
print "<pre>";
print_r($_COOKIE);
print "</pre>";
?>
see all the cookie values that are stored
Posted: Mon May 24, 2004 7:30 am
by ljCharlie
Thanks!
I'll give that a try.
ljCharlie