Page 1 of 1
need some help with cookies ...
Posted: Sun Jan 02, 2005 7:18 pm
by HormonX
Can someone help me with cookies ... i need to set a cookies with 2 variables and then check that cookie for those variables and display a message is they are present.
Can anyone help ?
Greg
Posted: Sun Jan 02, 2005 7:28 pm
by rehfeld
sure.
start by reading this page [php_man]setcookie[/php_man]
read the user comments too, they are your friend.
Code: Select all
<?php
setcookie('name', 'value');
// keep in mind you cant check if the cookie was set
// until the next time the browser requests a page
if (isset($_COOKIE['name'])) {
echo 'cookie was set.';
}
?>
Posted: Sun Jan 02, 2005 7:51 pm
by John Cartwright
note, you should set a expiration time when setting cookies.
Posted: Sun Jan 02, 2005 8:54 pm
by HormonX
thank you ...
that cleared up a bit
Greg