Re: Session problems
| From: | Richard Lynch | Date: | Tue, 28 Nov 2000 22:04:52 +0000 |
| Subject: | Re: Session problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27708@lists.php.net to get a copy of this message | ||
Session variables are not in any way, shape, or form made global to a
function.
----- Original Message -----
From: "Liam Gibbs" <lgibbs@microlegend.com>
Newsgroups: php.general
Sent: Monday, November 27, 2000 12:50 PM
Subject: [PHP] Session problems
Hi there,
I'm having some problems using some session commands. This worked on another
machine, but for some reason, when I transferred all the files onto a new
machine, it wouldn't work anymore. However, it's the exact same code.
Anyway, my problem is this: my session variable values aren't being
retained. I have a variable $username. When I go clicking around and set
$username, it's set (I can print() it out and it's the value I set it to). I
declare it as a session variable using session_start(); and
session_register(username);. Then I go clicking to the next page, and the
variable is no longer set (it's value is nothing), even though there is a
session_start(), which should make $username accessible (and unchangeable if
the php.net pages are correct). Now, I think I may know the problem:
The page I go to includes the page that has the session_start() command,
which runs a function that checks the value of my session variables. So I'm
asking for a variable two stack calls (is that the proper terminology?)
after my script page, and one stack call after my session_start() call (but
my print() statement says that $username is unset right after the call to
session_start()). But I thought session variables were completely global,
accessible from any page in any function. Does this mean that, on this new
machine, a setting is set so that session variables aren't global? Is there
another problem I don't know about? Can anyone help please?
Liam Gibbs