I think it's to do with the scope of the variable.

It will work if you declare the variable as global within the make_login function.

Michael Egan

-----Original Message-----
From: Alawi albaity [mailto:alawi@;php4web.com]
Sent: 13 November 2002 08:13
To: PHPList
Subject: [PHP] what wrong in this code ?[Scanned]


why the varible value(123) is not printed?

<?

function is_login(){
session_start();
  if (session_is_registered("test") ){
    return true;
  }//end if
  else{
    return false;
  }//end else
}// end is_login() function


function make_login(){
session_start();
session_register('test');
$test = 123;
}

function Logout(){
session_destroy();
}

if (is_login()){

Global $test;
session_start();
echo $test;
logout();
}else{
make_login();
?>
<a href="test.php">tryagain</a>
<?
}
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to