I am facing a another problem. I built a project in php. the url is like ‘www.mysite.com’
I create a cookie using setcookie() method in example1.php page which is under root directory and the path of the page is … www.mysite.com/in/example1.php
Now i want to retrieve the value of the cookie in the page ‘indix.php’ whose url is www.mysite.com/index.php that is outside the folder ‘in’.
But the cookie is not found in this index.php page.
i use print_r() but no cookie found.
What the wrong i have done? Please help me.
http://php.net/manual/en/function.setcookie.php
Scope of cookie is 4th variable (the “path”) – defaults to current path. Sounds like you need to set it to server root directory, or ‘/’.