Author |
Message |
Amailer

|
Posted: Thu Mar 04, 2004 7:19 pm Post subject: COOKIE [ SOLVED ] |
|
|
Okay, suppose i have this.
a variable
$variable = 'text.'$id_from_db;
i set a cookie for the $variable
setcookie($variable, $count, time()+60*60*24);
now what i want to do is..... to check if the cookie is set or not i.e
$COOKIE[$variable];
that doens't seem to work though, how would i get a cookie by using a variabel ( i.e $COOKIE[$variable]; ) if you know what i mean... |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
wtd
|
Posted: Thu Mar 04, 2004 8:19 pm Post subject: (No subject) |
|
|
Try using $_COOKIE instead of $COOKIE. |
|
|
|
|
 |
Amailer

|
Posted: Thu Mar 04, 2004 8:26 pm Post subject: (No subject) |
|
|
wouldn't that be just as a normal variable? also how does this solve my problem :S maby iv not explained it well enough.
I have set a cookie:
code: |
$cookie_name = 'gfxpro.'.$d2['d2_id'];
....
$count = 1;
setcookie($cookie_name, $count, time()+60*60*24);
|
now i want to check if that cookie isset so i did this:
code: |
if( isset($_COOKIE[$cookie_name]) ) {
...
}
|
but that doesn't work is there another way around this? |
|
|
|
|
 |
wtd
|
|
|
|
 |
Amailer

|
Posted: Thu Mar 04, 2004 8:43 pm Post subject: (No subject) |
|
|
ya but hmm but it's not working... i don't think it's setting cookie right with the name... |
|
|
|
|
 |
wtd
|
Posted: Thu Mar 04, 2004 9:09 pm Post subject: (No subject) |
|
|
It should be noted that changes in cookies won't be noticeable until the page is reloaded. |
|
|
|
|
 |
Amailer

|
Posted: Thu Mar 04, 2004 9:10 pm Post subject: (No subject) |
|
|
actually i checked, it is setting the cookie but the
if (!isset($HTTP_COOKIE_VARS[$cookie_name])) {
doesn't seem to be working, why!
problem solved:
i think it had to do with the . in the name... hmm idk i removed it and it worked lol... |
|
|
|
|
 |
|