Code has been added to clipboard!
Making a PHP Setcookie
Example
<?php
$name = 'user_cookie';
$value = 'Johny Dawkins';
setcookie($name, $value, time() + (86400 * 80), '/');
// 86400 = 1 day
?>
<html>
<body>
<?php
if (!isset($_COOKIE[$name])) {Â Â Â
echo "Cookie called '" . $name . "' has not been set!";
} else {Â
echo "Cookie '" . $name . "' has been set!<br>";Â Â Â
echo "Value in cookie is: " . $_COOKIE[$name];
}
?>
</body>
</html>