4. Example - Cookies <?php setcookie("user", “mni", time()+3600); ?> <html> <body> </body> </html> Create a cookie named user Assign a value to the cookie (user) The cookie will expire in ONE hour
5. How to Retrieve a Cookie Value? <html> <body> <?php if (isset($_COOKIE["user"])) echo "Welcome " . $_COOKIE["user"] . "!<br />"; else echo "Welcome guest!<br />"; ?> </body> </html> Retrieve a value from a cookie called user
6. How to Delete a Cookie? <?php setcookie("user", "", time()-3600); ?> Set the expiration date to ONE hour ago Reset the value of cookie