Re: Understanding sessions
| From: | K.Bogac Bokeer | Date: | Thu, 15 Apr 2004 05:16:42 +0000 |
| Subject: | Re: Understanding sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183416@lists.php.net to get a copy of this message | ||
You can use
$sid = session_name().'='.session_id();
instead of SID or you can define o constant
define('SID', session_name().'='.session_id());
at the start of script ( after session_start() ).
Todd Cary wrote:
I am trying to understand sessions are done with php. My "learning script" has the following: session_start(); if (isset($_SESSION['firstname'])) {$_SESSION['firstname'] = 'Todd';} else {$_SESSION['firstname'] = 'Nobody';} echo "SESSION: " . $_SESSION['firstname'] . "<br>"; echo 'SID: ' . SID . '<br>'; echo '<br /><a href="page_2.php?' . SID . '">page 2</a>'; SID is always empty. What have I missed? Todd