A cookie is simply a variable that your webpage can store on or retrieve from the user's computer.
The idea is that the next time the user arrives at your page, the value of the cookie can be read by your page, and then used for whatever purpose you choose.
Examples of cookies could be:
- First time the visitor arrives the name is entered.
(for example "John Wayne").
The username is then stored in a cookie.
Next time he arrives at your page, it writes something like:
"Welcome to my page John Wayne!!
Good to see you again".
The name is simply retrieved from the stored cookie.
- First time the user arrives at your page she enters the desired language.
The chosen language is stored in a cookie.
Next time she visits your site, she will simply be taken to the pages in the desired language without asking, since the desired language is retrieved from the cookie.
- First time the user arrives at your page he is asked to fill in a password.
The password is saved in a cookie.
Next time he arrives at your page, the password is retrieved from the cookie.