Using Multiple Values for a Cookie : Cookie « Cookie Session « PHP






Using Multiple Values for a Cookie


<?php
  if (!isset ($userdetails [0] ) ) {
     setcookie ("userdetails[0]", $username);
  }
  $userdetails[1]++;
  setcookie ("userdetails[1]", $userdetails[1]);
  echo ("Hello $userdetails[0], you've seen this page".$userdetails[1].($userdetails[1] == l?" time!": "times!"));
?>

           
       








Related examples in the same category

1.Creating a Test Cookie
2.Use cookie to create page counter
3.Setting and Printing a Cookie Value