Hello everyone,
Just got a simple question (i am sure it is simple to you ppl) about cookies.
I have a script in a directory:
/php/scripts/main/script.php
and in that script it sets some cookies like so:
setcookie("TestCookie", "Test Cookie Value");
setcookie("TestCookie1", "Test Cookie 1 Value");
Now i did not set a time limit cause i want the cookies to go away after the browser close. I also have another script in that directory:
/php/scripts/main/print.php
that simply prints the cookies like so:
print "Cookie 1 = $TestCookie";
print "Cookie 1 = $TestCookie1";
Now that all works fine and i am happy with that, the only problem that i have is when i move the print.php file.
Here is an example:
I set up a page /main.php to call the script /php/scripts/main/script.php and set the cookies, so the script.php file sets the cookies and that is all good.
Then later i have another file called /main1.php that needs to read the cookies, but it can not find them?? If i run the file /php/scripts/main/print.php it shows the cookies, yet if i copy that file to the root of the server / and run it, it does not show any cookies.
In my mind this means that the cookies are not set site wide and the sctipt to read the cookies has to be in the same dir as the script that made the cookies.
My question is - How can i make the Cookies site wide??
Meaning how can i make it so that any script can read the cookies no matter which directory the script is in.
Thanks for the help.
-|- Hurgh -|-
PS i know that there is an option when setting the cookies for directory, and i think that might have something to do with it, but i have fiddled round with it and have not yet been able to get it to work. Any sugestions would be great. Thanks again.