September 23rd, 1999, 09:25 AM
How many variables can I save to a cooky?
How do I get the variables out of a cooky?
There is a time field to set up but i want it to be available forever, how can i dot that?
Thx for answer
September 23rd, 1999, 12:14 PM
Basiclly PHP treats cookies as if they where a variable. You don't store any number of variables inside a cookie per se, but the cookie itself is the variable and it's value is equal to whatever text you stored in the cookie.
For example if I stored a cookie name UserConfig with the value "bleh" on a user's machine, the next time that user access one of my sites the variable $UserConfig will equal "bleh"
If you need to store more than one variable in a cookie take a look at the serialize/unserialize and the explode/implode functions. They will enable you to store multiple values in one cookie.
Also you have to specify a time for the cookie to expire. You can not set a cookie to last forever. The best you can do is to set it for the maximum time you can.