Ronald "The Newbie" Allen wrote:

aHere is my code...

<?
setcookie("cookie[name]","$_POST['name']", time()+86400)
setcookie ("cookie[email]","$_POST['email']", time()+86400)
setcookie ("cookie[bgcolor]","$_POST['bgcolor']", time()+86400)
setcookie ("cookie[tcolor]", "$_POST['tcolor']", time()+86400)

?>
I have to use cookies, since I am taking a class and it dictates that we use
cookies, but I can't email my instructor since she never responds.  So how
do I use a cookie to record multiple values?  Help would be appreciative.a


As the standard says, 1 cookie = 1 value, no way to have more than one value in a cookie.


But you can think about some workarounds, a quick example just to give you an idea:

$cookie = implode(':', $array)

Here you will have all values from the array in the cookie, and using : as a separator.

To reverse the values: $values = explode(':', $cookie) and here you will have all values in the array $values, starting with index 0.

Of course, in this way you can only set values, not the array keys. Look in the manual for implode() and explode() and see if is usefull for you.

Regards,
Jordi.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to