A PHP cookie is a small file that is embeded on the user’s computer by the server. Each time the same computer requests a page with a browser, it will send the cookie too.

The setcookie() function is used to set a cookie.

The setcookie() function must appear BEFORE the <html> tag.

A cookie can be retrieve using $_COOKIE['cookie-name'].

Syntax: setcookie(cookie-name, value, expire, path(optional), domain(optional));

Example

<?php
$expire = time()+60*60*24*30; //set expiration time to (60 sec * 60 min * 24 hours * 30 days).

setcookie("name", "Bryan Lusica", $expire);
?>
<html>
<head>
<title>Test</title>
</head>
<body>

<?php echo $_COOKIE["name"]; ?>

</body>
</html>

 

Deleting a Cookie

Unlike session, cookie does not have unset command. To delete a cookie, you need to set an empty value with an expiration time into a cookie which is less than the current time.

Example

<?php
// set the expiration date to one hour ago
setcookie("name", "", time()-3600);
?>

How to take Cialis it seems to me that would already be time to cease to discuss this question. As I already answered it not once. Have it in a look. You shouldn’t worry! All deer go south when they are called by homesickness. Are turned and lie on snow till some hours.