> retrieve data from cookie php ~ Online tutorial

retrieve data from cookie php

How to Retrieve a Cookie Value?
The PHP $_COOKIE variable is used to retrieve a cookie value.
In the example below, we retrieve the value of the cookie named "user" and display it on a page:

<?php
// Print a cookie
echo $_COOKIE["user"];
// A way to view all cookies
print_r($_COOKIE);
?>
In the following example we use the isset() function to find out if a cookie has been set:

<html>
<body>
<?php
if (isset($_COOKIE["user"]))
{
echo "Welcome " . $_COOKIE["user"] . "!";
}
else
echo "Welcome guest!";
}
?>
</body>
</html>

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: