This is a discussion on Simple cookie usage within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'd like to add cookies to my website but I don't understand the usage of it. I've ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
> I'd like to add cookies to my website but I don't understand the usage of
> it. I've read and tried the examples of the tutorial but it just don't work > with me. > > Does anyone have a little working write and read example? > I'm not completely sure on what your intentions are, but maybe this can be used: setcookie ("Username", $Userid,time()+2592000); /* expire in 30 days */ setcookie ("Country", $Country,time()+2592000); /* expire in 30 days */ if (isset($_COOKIE['Username'])) { $Username = $_COOKIE['Username']; unset $Country; if (isset($_COOKIE['Country'])) { $Country = $_COOKIE['Country']; Remember that the setcookie mus be used before any header is sent. Poul |