problem with session-hendling inside of function

General discussions related to php

Moderators: macek, egami, gesf

glow
New php-forum User
New php-forum User
Posts: 10
Joined: Tue Nov 26, 2002 11:00 am

try

Postby glow » Mon Dec 16, 2002 3:53 am

maybe you'll find by this Link http://www.php.net/manual/en/language.oop.php
useful information! :-) I'm a newbe too!*g*

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: problem with session-hendling inside of function

Postby WiZARD » Mon Dec 16, 2002 8:58 am

mrusi wrote:Hi,
I have following problem,
with a code something like this:

<?php
session_start();
$HTTP_SESSION_VARS['user']=1;

if (isset($HTTP_SESSION_VARS['user'])){
echo "hi";
}
?>

In this case, it works, the output is "hi" as expected.


But when I make it like this:

<?php
session_start();
$HTTP_SESSION_VARS['user']=1;

f();

function f(){

if (isset($HTTP_SESSION_VARS['a'])){
echo "hi";
}

}

?>

In this case, I get no output.Could somebody please
explain me this? I guess the HTTP_SESSION_VARS
cannot be seen inside of a function. Is there a
workaround for this?

Thanks in advance:

Gabor

Hi! You so strange man! that is variable $a? you asking if $a is is? if true then show "hi".... Where is $a?


Return to “PHP General”

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 1 guest