Hi I wanted to see if cookie is set or not... For example i have site example.com and there is directory named member in it i set a cookie in that directory i.e. example.com/cookie can i read and/or access that cookie value from example.com ? if i can please tell me how... my domain name: example.com i set a cookie at: example.com/member and now i wanted to read it from example.com
You would need to set the path parameter of setcookie (http://php.net/setcookie) to '/' and then you'll be able to access it from your root as well. So: setcookie('key', 'value', 0, '/');
thank you but i wanted to know that i am at example.com and cookie is at example.com/members is there any way i can access it form example.com thank you
urrently i am at example.com/members I set a cookie "test_cookie" I can access it here but i wanted to access it when i go back to example.com I tired it this way: <?PHP print_r($_COOKIE); ?> Code (markup): but it's not showing my anything but when i go to example.com/members and use same code i get value
use path / and domain .example.com (attention to the point). now you can access the cookie on the complete website including subdomains and folders. but you need to delete your cookies first, as it is not possible in all browsers to set a cookie with the same name with a different path and/or domain. php.net:
Set the cookie like I told you.. Do that code on /members. Then access it via the $_COOKIE array on your root.