Simple Code To Set And Retrieve Cookie Using PHP
Setting a cookie using PHP
<?php
$expire=time()+60*60*24*30;
setcookie(“user”,”Balu”, $expire);
?>
<html></html>
Retrieve a cookie using php
<html>
<body>
<?php
if (isset($_COOKIE["user"]))
echo “Welcome ” . $_COOKIE["user"] . “!<br />”;
else
echo “Welcome guest!<br />”;
?>
</body>
</html>
Very simple is it….enjoy!!!!!!!!!!!!!!
Related posts:
- How To Set And Get Cookies Using PHP
- Warning: session_start(): Cannot send session cookie headers already sent
