Jump to content


Photo

Cookie, using a dynamic value


  • Please log in to reply
4 replies to this topic

#1 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 29 July 2006 - 11:55 PM

So I have a cookie set, and I named it with a dynamic value. And I do not know how to retrieve its value.

so lets say I have a varialble, like $val1    how can I retrieve the cookie? $_COOKIE['$val1']; ??
Can you please tell he how can it be done, if it can?

Thanks.

#2 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 12:12 AM

<?php
echo $_COOKIE['val1'];
?>

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#3 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 30 July 2006 - 12:44 AM

thanks for your reply :D

though it didn't work for me :(  is that how its done?

I will keep trying, however. :)

#4 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 03:54 AM

Did you get an error or something? I personally use sessions on my site and that's the same syntax that works for me.

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#5 w32

w32
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 30 July 2006 - 06:20 AM

the result I was trying to echo didn't show up, when it was like this:
<?php
echo $_COOKIE['val1'];
?>

however this worked:
<?php
echo $_COOKIE[val1];
?>

thanks btw :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users