Why when set php cookie path to "/" doesn't work for every subdirs in the domain, but just for the current diretory.
cookie is set like: setcookie("name", "val", expire_time, "/");
it just doesn't want to work. Any help appreciated.
Why when set php cookie path to "/" doesn't work for every subdirs in the domain, but just for the current diretory.
cookie is set like: setcookie("name", "val", expire_time, "/");
it just doesn't want to work. Any help appreciated.
Setting the cookie path to /
should make it available to the entire domain. If you set your cookie like that, and it isn't being sent, there is something else wrong.
Try using the Web Developer addon in Firefox. It shows you details on the available cookies. Maybe that can help you diagnose the problem.
try including the domain parameter: setcookie("name","val",expire_time,"/",".domain.com"); // don't forget the prefixing period: .domain.com
that will enable all sudomains of "domain.com"
It works now.
I've deleted the cookie and set it up again a few times and works, because first it was set without the path parameter.
Thanks for your quick replies.
Are you testing on localhost? In that case, you need to pass null as the value for $domain
.