Posts: 1,832
Location: Somewhere else entirely
|
There are several choices - you can either a) set multiple cookies, b) squash the data into a string, store it in one cookie and then unsqash it later, or c) use array names for cookies (PHP makes them look like arrays but in fact they are just multiple cookies):
PHP Code:
//multiple cookies setcookie("foo1","data1"); setcookie("foo2","data2"); setcookie("foo3","data3");
//one cookie setcookie("foo","1,data1|2,data2|3,data3");
//Array names setcookie("foo[1]","data1"); setcookie("foo[2]","data1"); setcookie("foo[3]","data1");
In the one cookie case when you want to use the data you must pull apart the string with explode() or other string functions. The |s and commas aren't special in any way, they just make it easier to do the pulling apart later.
When you read from the $_COOKIE array, the array name method will mean you have one entry in $_COOKIE called $_COOKIE['foo'] which is itself an array.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)
|