First, make sure that you understand what cookies are. Cookies use persistent client-side storage to allow data to be saved between and shared among multiple connections. HTTP connections are inherently stateless; cookies provide a mechanism for preserving states.
Then read the cookies entry in the PHP manual.
Then look at this example:
http://yelvington.com/howtheme.php3
Once a cookie is set, its value is available to all subsequent PHP scripts within the domain of the cookie.