i'm trying to get one of the values i've set into a cookie, but i'm getting nowhere.
to set the cookie, i used:
setcookie ("cookiename[0]", $var1, time()+360024, "/");
setcookie ("cookiename[1]", $var2, time()+360024, "/");
setcookie ("cookiename[2]", $var3, time()+3600*24, "/");
i checked in the directory where IE stores the cookies it receives and found it, so no problem setting it.
i even saw all three values were inside the cookie, so they're there, that's for sure.
but when i tried to call a value and set it into a variable, that's where things went wrong.
i made a very simple page to test if i could get the values out of it, the only things even remotely calling to it were the following lines:
print_r($COOKIE["user"]);
$value3 = $COOKIE["cookiename[3]"];
echo "<br>cookievalue[3] is $value3";
which gave me a result like this:
Array ( [0] => medium [2] => medium [3] => 2 )
Notice: Undefined index: cookiename[3] in (path)(filename.ext) on line 6
line 6 was this one:
$value3 = $_COOKIE["cookiename[3]"];
i've tried fiddling around with the params in the $_COOKIE var, but nada. i can't retrieve the value.
when i do this:
$cookie = $_COOKIE["cookiename"];
echo "<br>" . $cookie;
then all i get on the page is "Array" which is not what i'm after.
i'm probably missing something blatently obvious, but does anyone know how i can get a particular one of those [0] to [2] values into a var?