Page 1 of 1

Putting empty into cookie = (null)

Posted: Sun Feb 24, 2013 9:11 am
by bangkok
To test if a cookie exists, i do :

Code: Select all

put $_COOKIE into allCookies
put allCookies["mycookie"]  into mycookie
if mycookie is empty then put "problem"
But if in order to reset the cookie, i do :

Code: Select all

put cookie "mycookie" for "/" with empty
... its value becomes "(null)"

which defeats the first test.

Is it normal ? Should I just add a condition <>"(null)" to the "empty" condition and don't bother ?

Re: Putting empty into cookie = (null)

Posted: Mon Mar 11, 2013 12:17 pm
by Mark
Hi,

The cookie returns null because it is empty but still exists. This is normal. To delete a cookie, you can overwrite it with an expiry date in the past.

Kind regards,

Mark