Create Cookie

Cookies can be created using the function ‘ setcookie(name,Value ,exp,path,domain)’ and its arguments are given below

Name :Name of the cookie that store the value and it is using to retrieve the stored data

Value : Its the value to be stored in the cookie ()generally we store login details like username , password)

exp : This is the the time that cookie lasts . if its not set ,the cookie will get destroyed when the browser closed .

path : This is path where the cookie to be stored

Domain: Domain where the cookie to be generated

Example
======

<?php
setcookie(“user_name”, “phpcodez”, time()+3600);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *