Assigning cookie names according to array index value : setcookie « Cookie Session « PHP






Assigning cookie names according to array index value

 
<?
setcookie("php[uid]", "1111111111111111", time()+3600);
setcookie("php[color]", "black", time()+3600);
setcookie("php[preference]", "english", time()+3600);

if (isset ($php)) {
   while (list ($name, $value) = each ($php)) {
      echo "$name = $value<br>\n";
   }
}
?>
  
  








Related examples in the same category

1.PHP 5 setcookie() Parameters
2.Cookie created
3.Deleting Cookies
4.Setting a cookie with a domain restriction
5.Setting a cookie with a path restriction
6.Setting an expiring cookie
7.Setting cookie expiration
8.Setting the cookie domain
9.Setting the cookie path
10.Setting the cookie path to a specific directory
11.Deleting a Cookie Using setcookie()
12.The cookie expires one day from now
13.Starting a page with setcookie()
14.Reading Cookies