How to Delete a Cookie?
When deleting a cookie you should assure that the expiration date is in the past.
Delete example:
What if a Browser Does NOT Support Cookies?
If your application deals with browsers that do not support cookies, you will have to use other
methods to pass information from one page to another in your application. One method is to pass
the data through forms (forms and user input are described earlier in this tutorial).
The form below passes the user input to "welcome.php" when the user clicks on the "Submit"
button:
Retrieve the values in the "welcome.php" file like this:
When deleting a cookie you should assure that the expiration date is in the past.
Delete example:
<?php // set the expiration date to one hour ago setcookie("user", "", time()-3600); ?> |
If your application deals with browsers that do not support cookies, you will have to use other
methods to pass information from one page to another in your application. One method is to pass
the data through forms (forms and user input are described earlier in this tutorial).
The form below passes the user input to "welcome.php" when the user clicks on the "Submit"
button:
<html> <body> <form action="welcome.php" method="post"> Name:<input type="text" name="name" /> Age: <nput type="text" name="age" /> <input type="submit" /> </form> </body> </html> |
Retrieve the values in the "welcome.php" file like this:
<html> <body> Welcome <php echo $_POST["name"]; ?>. You are <php echo $_POST["age"]; ?> years old. <body> <html> |
0 comments:
Post a Comment