Php - How to use php cookies, Create and use cookies values

How to use php cookies

How to use php cookies

Cookies allow the webmaster to store information about the site visitor on their computer to be accessed again the next time they visit. One common use of cookies is to store your username and password on your computer so you don't need to login again each time you visit a website.

Create a Cookie?
   setcookie(name, value, expire, path, domain);

Example:
  <?php
    setcookie("user", "cookie value", time()+36000);
  ?>

Retrieve cookie value
  <?php 
     echo $_COOKIE['user'];
  ?>

Delete a Cookie
   <?php
      setcookie("user", "", time()-3600);
   ?> 
To delete a cookie set the expiration date to the past date.

These are the simple examples to use the cookies. You can use the cookies when ever you want to retrieve the store vales in browser.

The topic on Php - How to use php cookies is posted by - Venki

Hope you have enjoyed, Php - How to use php cookiesThanks for your time

Tech Bluff