> I presume I am right in assuming that I can declare variables anywhere I
> like providing I have started a session on the page but I cannot
> actually use those variables until a post or some similar action has
> been performed by the user.

No, you can use them right away - they are stored server-side, so you
don't need to wait for a request/response loop before reading them:

        session_start();
        $_SESSION['foo'] = 'bar';
        echo $_SESSION['foo']; // 'foo' is available immediately

No need to perform any special declarations. It's cookies that need to
wait for a subsequent request to be available via getcookie().

Careful with your session variable naming - you may want to implement a
primitive namespace, by using named arrays in $_SESSION, such as
$_SESSION['auth']['username'] or $_SESSION['prefs']['boxers_or_briefs'].

-mike.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to