note 25452 added to features.cookies
| From: | psyjoniz at hotmail dot com | Date: | Tue, 24 Sep 2002 14:09:05 +0000 |
| Subject: | note 25452 added to features.cookies | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37187@lists.php.net to get a copy of this message | ||
variable variable's vs. variable cookies
--------------------------------------
this is more of a question really - i've been playing with cookies for a while now so i know
that i'm not missing something or doing incorrect syntax. at any rate - this is the problem:
i've got a value that i need to set for report modes to change based on which client a user
might be looking at - like if they leave the report in one mode they want to come back to that same
client in the same mode but not necessairily that mode for all clients that they will be looking at
so i decided that setting a cookie would be good - but the cookie name needs to be dynamic.
variable variables:
---------------------------------------
$dynamic_value = "0123";
$var_var = "dynamic_var_name_" . $dynamic_value;
// the dynamic var name ends up being: 'dynamic_var_name_0123'
$dynamic_var_name_0123 = "output";
echo($$var_var);
---------------------------------------
the last line echo's 'output'
the problem is that when i try to dynamically set a cookie ("cookie_data[pre_" . $var .
"]") it sets the cookie just fine but when i try to recall it dynamically it will not come
up. anyone know if this has something to do with the cookie not being available in some fashion?
--
http://www.php.net/manual/en/features.cookies.php
http://master.php.net/manage/user-notes.php?action=edit+25452
http://master.php.net/manage/user-notes.php?action=delete+25452
http://master.php.net/manage/user-notes.php?action=reject+25452