Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

problem with session-hendling inside of function

General discussions related to php

Moderators: macek, egami, gesf

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*
glow
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Nov 26, 2002 11:00 am

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?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron