RE: [PHP] what wrong in this code ?[Scanned]

From: Date: Wed, 13 Nov 2002 08:58:56 +0000
Subject: RE: [PHP] what wrong in this code ?[Scanned]
Groups: php.general 
Request: Send a blank email to php-general+get-124187@lists.php.net to get a copy of this message
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> <? } ?>

« previous php.general (#124187) next »