http://php.net/manual/en/function.setcookie.phpCytat
path
The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
Znaczy to tyle, że jeżeli nie ustawisz parametru
path, to domyślnie będzie miał on wartość ścieżki, pod którą został ustawiony i ciastko nie będzie dostępne z poziomu innych ścieżek. Tak więc rób to w ten sposób: