echo $_COOKIE [“user“];
In PHP, you can retrieve a cookie value using the $_COOKIE
superglobal array. Here’s how you can do it:
php
<?php
// Check if the cookie is set
if(isset($_COOKIE['cookie_name'])) {
// Retrieve the value of the cookie
$cookieValue = $_COOKIE['cookie_name'];
echo "The value of the cookie is: " . $cookieValue;
} else {
echo "Cookie is not set.";
}
?>
Replace 'cookie_name'
with the name of your cookie. This code checks if the cookie is set, and if it is, retrieves its value. If the cookie is not set, it will display a message indicating that the cookie is not set.