Set and Read Cookies in PHP/Smarty

To set a cookie:
setcookie(‘TestCookie’,’testvalue’, time()+3600, ‘/’);

Function definition:
setcookie(“TestCookie”, $value, time()+3600, more info

“/”, “.example.com”, 1);

To read a cookie:
echo ‘Hello ‘.$_COOKIE[‘TestCookie’];


Subscribe to comments Comment | Trackback |
Post Tags: ,

Browse Timeline


Add a Comment

You must be logged in to post a comment.


© Copyright 2009-2010 Alpha Papa Hotel . Thanks for visiting!