Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- $cookie_n = "user";
- $cookie_value = "John Doe";
- setcookie($cookie_n, $cookie_value, , "/");
- ?>
- <html>
- <body>
- <?php
- if(!isset($_COOKIE[$cookie_n])) {
- echo "Cookie named '" . $cookie_n . "' is not set!";
- } else {
- echo "Cookie '" . $cookie_n . "' is set!<br>";
- echo "Value is: " . $_COOKIE[$cookie_n];
- }
- ?>
- <p><strong>Note:</strong> You might have to reload the page to see the value of the cookie.</p>
- </body>
- </html>
- setcookie($cookie_n, $cookie_value, '' , "/");
- Warning: setcookie() expects parameter 3 to be integer, string given in ... on line 5
- Cookie named 'user' is not set!
- Note: You might have to reload the page to see the value of the cookie.
Add Comment
Please, Sign In to add comment