This shows with simple examples how to use "cookies" to remember things. Look at the code AND at the HTML source each time a page is generated.
Note that session management is a more powerful solution in most cases.