Perhaps you don't have a clear concept of how HTTP works?
The client browser makes a tcp/ip connection to the web
server and sends one of three possible request types:
(1) GET, which simply requests a web page, image, or
other file (including php pages). The request may
contain additional header lines that send back cookie
information, control caching, describe the browser in
use, etc. The request is ended by a blank line.
At this point, the browser is all done sending data to
the server. The server then responds by sending back
a response packet, containing one or more header lines
(such as OK or a numeric error message such as 404 for
page not found.) The header is followed by the data
requested (if any), typically html-formatted text in the
case of an ordinary web page. At this point, the http
transaction is <b>over</b>. The client and server may
conspire to keep the tcp/ip session alive as a way to
increase performance, but this is completely hidden from
the higher levels of the server and browser and any
subsequent page requests proceed exactly as if the
tcp/ip session were terminated and needed to be established
all over again.
(2) POST, which works exactly as does GET, except that the
clients request header is followed by any variables from the
form as name=value pairs.
(3) PUT which is not much used and will not concern us here.
Cookies were first proposed by Netscape as a way to store
a limited amount of information at the browser between http
requests, and so allow a browser to maintain state as it moves
between the various pages of a web site. If your data needs
are minimal, you can just store the data as a cookie (and hope
your users haven't disabled cookies) but more often you will
just store an identifier that is used to identify data that you
have saved on the server as part of a previous http transaction.
(This is essentially what "php sessions" do, whether you use
PHPLIB, the session support build into 4.x, or roll your own.)
It is also possible to pass the session identifier as part of the
URL.
To summarize, http is inherently stateless, and the information
associated with the requesting and displaying of a single page
is inherently transitory, unless you take special steps to save
the data at the server between pages, and provide the client
with some method of telling the server which set of saved data
to restore.