Re: session_start() question
| From: | Justin French | Date: | Thu, 08 May 2003 00:56:14 +0000 |
| Subject: | Re: session_start() question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146772@lists.php.net to get a copy of this message | ||
on 09/05/03 12:42 AM, C.R. (odcs@rogers.com) wrote:
> Can someone explain session_start() as I am still don't have a full grasp of
> sessions. In the following example I have to use session_start() on both of
> the pages below, but once a session is started why would I need to do this -
> does it not carry from page to page? - confused.
see http://php.net/session_start
"session_start() creates a session or resumes the current one based on the
current session id that's being passed via a request, such as GET, POST, or
a cookie."
the key words are "creates a session or resumes the current one"
page 1
<?
session_start();
$_SESSION['pet'] = 'cat';
?>
page 2
<?
session_start();
echo $_SESSION['pet'];
?>
Justin