Re: PHP session problems
| From: | Fredrik de Vibe | Date: | Tue, 25 Feb 2003 15:44:00 +0000 |
| Subject: | Re: PHP session problems | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25911@lists.php.net to get a copy of this message | ||
haloplayer@hotmail.com (David Rice) writes:
> I have been having trouble with PHP sessions, the session variables
> are not able to be called through the script.
>
> If have commented the area at the bottome where the session variable
> is NULL when var dump is called to check it (about 20 lines from the
> bottom... depending on if the text is wrapping or not)
[ snip ]
> <?
> session_start();
> session_register('valid_user');
> session_register('name');
> /* Start A Session */
- Is register_globals on or off?
- Which PHP version?
In PHP 4.2, I think, you have to use $_SESSION["foo"] = "bar" instead
of session_register("foo") if register_globals is off. This is afaicr
fixed in 4.3.
[ snip ]
> <form name="register" method="post" action="<? echo $PHP_SELF;
> ?>">
> <?
[ snip ]
> session_register('valid_user');
You can't register a session variable after output. You have already
registered it, just set $valid_user = 'something'.
I might not remember everything completely, but the manual will at
least give you the correct answers if mine are wrong. ;-)
--
--Fredrik
In an organization, each person rises to the level of his own
incompetency
-- The Peter Principle