|
Posted by Dikkie Dik on 11/30/06 15:16
<snip>
> I also tried to set a $_SESSION['welcome'] variable, but still, each
> time I reenter my page, it's reassigned a new instance.
>
> It's crazy, I would never have thought that it would be such a hassle
> to keep a variable value between pages (without using URL parameters).
Sorry, I did not correctly read your message, and I thought it was
re-created within one page request. If you want something kept between
page requests, you'll need a session. There's no need to store the
object itself in the session, although that is not impossible. Even
then, the object will be re-created (unserialized) for each page visit.
You can store just the data itself in the session (I assume it is one or
more arrays) and have your instance check for existence of that session
data at instantiation. Be sure to start the session before any data is
sent to the client by calling session_start(). See
http://nl3.php.net/manual/en/function.session-start.php for more info.
Best regards.
Navigation:
[Reply to this message]
|