software development


i’m using PHP throughout my pages… I can create a cookie, but for some reason it won’t let me delete them.

I’m using this for a login/logout situation…

here is some of my code:

setcookie(“AcctInfo[username]”, $username, time()+60*3, “/directory/”, “”);

setcookie(“AcctInfo[password]”, $password, time()+60*3, “/directory/”, “”);

The above code sets the cookie fine and it expires it if you stay logged on too long. (I changed the domain and folders for security reasons).

Then when I try to delete the cookie it doesn’t work. I tried the following below:


Thanks in advance for your help.


You need to include all of the information you put into your cookie when you initially set it. So if your cookie were set using:
setcookie(“AcctInfo[username]”, “$username”, time+60, “/directory/”, “”);

delete it using:

setcookie(“AcctInfo[username]”, “”, time-60, “/directory/”, “”);

At least, the above works for my pages.



oh ok, thanks… i’ll give it a shot to see if it works

edit: it works!!!