Richard Hulbert wrote:
in article 6K**************@news7.onvoy.net, Justin Koivisto at
sp**@koivi.com wrote on 10/7/03 8:01 pm:
Richard Hulbert wrote:
Can Someone tell me why This doesnąt work:
Page 1
$_SESSION['composer'] = 'A non';
Page 2
Echo $_SESSION['composer'];
( I get undefined variable)
do you have session_start() on the top of page 2 ?
No That Was it many thanks!
But I would like to understand what's going on why put this on page two and
not page 1
session_start is to signify to support sessions. If there is no current
session data, it simply initializes the _SESSION array. If there is a
session in progress, it checks that it is valid, etc, then loads the
previous values into the _SESSION array.
You didn't need it on the first page beacuse assiging a value to an
element in _SESSION implicitly calls session_start first, then assigning
the value (at least when you haven't explicitly started the session).
--
Justin Koivisto -
sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.