Setting a cookie with an array?
| From: | Joseph Stein | Date: | Sat, 18 Nov 2000 09:58:30 +0000 |
| Subject: | Setting a cookie with an array? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26033@lists.php.net to get a copy of this message | ||
OK, here's a new one (for me)...
I have (sometimes) an array (and sometimes, just a single variable), that I would like to set a cookie for as a "Favorite"...
In other words, if you goto my website (http://www.joescanner.com/) and use one of the search pages, you get a <SELECT> box and in some cases you can select multiple items.
I would like to remember which items are selected by a user, and with that users permission (by checking a box, more than likely) setting the cookie to remember which systems to select.
Will I need to write (or borrow :) a routine to change the array into a string, and then parse the string back into an array once the page is loaded? Or does PHP have some magic formula that does what I am looking for?
Also, to complicate things, not all pages allow multiple items to be checked, in which case I would want to use the first item (in the possible array).
If I am not being clear, please contact me via PRIVATE e-mail and I will try to be more succinct.
Thanks in advance for any ideas, or help.
Joe