Chapter 14. Cookies and Sessions

This lesson examines two ways of passing data between pages of a website without requiring a form submission from one page to another: using cookies and using sessions.

Cookies

Cookies are small pieces of information that are stored in your web browser. They typically contain data that is used to identify you when you look at a website so that site can be customized for each visitor.

Rather than having to pass data to a script by using a form or as values in the query string, cookies are sent back to your scripts automatically by your web browser. Even if you go off and browse to another website, their values are remembered when you return.

For example, if you have to log in to access a particular website, you may ...

Get Sams Teach Yourself PHP in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.