Re: Global Variable Change

From: Date: Sat, 02 Mar 2002 03:47:10 +0000
Subject: Re: Global Variable Change
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86881@lists.php.net to get a copy of this message
Thomas Brodkorb wrote:
Hi folks, small problem with globals: I would like to set a variable global called "Language". This seems to be not a really problem, but it is. Index.php: <?php { session_start(); if (!session_is_registered('Language')) {
    session_register('Language');
    $Language = 1031;
} ... ?> But all other pages do not have really access to this variable without calling "start_session()" from within the other pages().
You must start session implicitly or explicitly. I suggest to start session explicitly. Do not use auto start.
If I call, it works. Now the real problem. I would like to set $Language by an Hyperlink with image hyperlinks, but it doesnt change anything. Within the hyperlink I call "setlanguage.php?lang=1033" <?php { session_start(); if ( ($lang <> "1031") and ($lang <> "1033") ) {
    $lang= "1031"; }
$Language = $lang; if (session_is_registered('Language')) {
    session_unregister('Language');
} session_register('Language'); } ?> But it doesnt change ANYTHING !!!!
What is not changed? -- Yasuo Ohgaki

« previous php.general (#86881) next »