Bake Your First PHP Cookie


Cookies are small pieces of information that are stored in your web browser. They typically contain data that is used to identify you when you look at a website so that site can be customized for each visitor.

The following script will set a cookie with the value of an email addess. It will also have an expire date / time.

The "echo" part of the script simply displays the cookie which we have set.


Script Source


setcookie("email", "", time() + 3600);
echo "<PRE>";
echo "<PRE>";


Please let me know if this script was helpful to you.