Cookie Create and Delete and View in same page and other page
<?php
//When we want to set cookie then cookie should be set before html code as shown below:
$cookie_name = "user";
$cookie_value = "Hello World";
// To set the cookie, setcookie() function is used
setcookie($cookie_name, $cookie_value, time() + (86400), "/");
?>
<html>
<body>
<?php
if(!isset($_COOKIE[$cookie_name]))
{
echo "Cookie is not set";
}
else
{
echo $_COOKIE[$cookie_name];
}
?>
</body>
</html>
Below is other File(Page)


Comments
Post a Comment