- Cookies are small text files that can be stored in the "Cookies folder" that have coded information.
- They are not dangerous and only hold text information
- Setting a cookie:
- <?php
setcookie('userName', 'JaneSmith', time() + 4800);
echo '<h1>Cookie has been set</h1><br>';
?>
- <?php
- Testing the cookie:
- <?php
echo 'Reading cookie<br>';
echo 'userName = ' . $_COOKIE['userName'];
?>
- <?php
- Check it out live here
- Download the files