>I have been trying to get cookies to work. It seems I can get this cookie to
>be persistant in the browser but I want to write it to my Cookies Folder.
>I have tried many variations but when I look in the folder there is nothing
>there from my Domain.
>This is a simlified version but, I have tried many things.
What have you tried?
Presumably you have read and followed the examples at
http://uk.php.net/setcookie ?
--
Andy Hassall :: an...@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
I leave the browser open and check my Cookies folder and ...Nothing .
Thanks
Mike
"Andy Hassall" <an...@andyh.co.uk> wrote in message
news:4k00n19af9ci53k1a...@4ax.com...
>Heres a perfect example;
><?php
>$value = 'something from somewhere';
>setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
>?>
>Can be found at:(My Domain)
>http://www.ampsoft.com/B.php
>
>I leave the browser open and check my Cookies folder and ...Nothing .
That works for me, both on Firefox 1.5RC1 and Internet Explorer 6.
A cookie is set and stored; contents of the file from IE is:
TestCookie
something+from+somewhere
www.ampsoft.com/
1024
3124430464
29746191
1793278832
29746183
*
Add the following:
print "<pre>";
var_dump($_COOKIE);
print "</pre>";
Then you will be able to see what cookies the browser has accepted and sent
back.
If you're not getting anything, then you have a browser configuration problem.
>I'm getting:array(0) {
>}
Try refreshing it.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
They /are/ stored on the client computer. You just need to read *all*
of the manual page:
<quote>
Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.
</quote>
(Just below the table where the parameters are explained in detail.)
--
Kim André Akerø
- kima...@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Doesnt:
<?php
$value = 'This cookie doesnt write';
setcookie("TestCookie", $value);
?>
Does:
<?php
$value = 'This cookie writes';
setcookie("TestCookie", $value,time()+3600); /* expire in 1 hour */
?>
> Yes, But they are not written to the Cookies folder unless there is an
> expiration time.I tried this several times.
> Run http://www.ampsoft.com/Doesnt.php
> Refresh as much as you want---No cookie written to disk(Cookies
> Folder) Run http://www.ampsoft.com/Does.php
> Refresh - a cookie is written.
>
> Doesnt:
> <?php
> $value = 'This cookie doesnt write';
> setcookie("TestCookie", $value);
> ?>
It did, and I'm using Opera 8.5. Although it doesn't have a cookies
"folder", it does allow me to access all cookies set for all domains.
For the "expire" parameter of setcookie():
"If not set, the cookie will expire at the end of the session (when the
browser closes)."
> Does:
> <?php
> $value = 'This cookie writes';
> setcookie("TestCookie", $value,time()+3600); /* expire in 1 hour */
> ?>
--
>Yes, But they are not written to the Cookies folder unless there is an
>expiration time.
If there is no expiration time, then the cookie is valid until the browser
window is closed.
So, why should the browser bother writing it to disk when it can just keep it
in the area of memory associated with that browser window?
I dont doubt that it is not working for you, but to say that it does not
work would be out of the question, because 1000s of people around the world
are using this method very successfully. There must be something else that
is wrong, e.g.
- php not installed correctly
- caching problem
- etc...