[PHP] http_get_var and isset() not working with script generated includes.

2002-11-18 Thread Moo
I wrote a bug report but [EMAIL PROTECTED] bogusified my report without the
least bit of information.
My script uses multiple includes and the file names all have the same
syntax. So instead of writing each individual include, I created an
array which contains all the filenames

function LoadSections($sections)
{
 foreach ($sections as $key = $value)
 {
  include mod.section. . $value . .php;
 }
}
instead of writing
include file_x;
include file_y;
and so on

All the files load well except that I cannot access HTTP_GET_VARS and
the isset() function always return false (when they are inside the included
files).

NB My includes work fine when loaded individually



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




Fw: [PHP] http_get_var and isset() not working with script generated includes.

2002-11-18 Thread Kevin Stone
Copy and pasted from the PHP manual:

If the include occurs inside a function within the calling file, then all
of the code contained in the called file will behave as though it had been
defined inside that function. So, it will follow the variable scope of that
function.

So in other words any script you include inside the function LoadSections()
will be local to that function.

-Kevin

- Original Message -
From: Moo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 1:55 PM
Subject: [PHP] http_get_var and isset() not working with script generated
includes.


 I wrote a bug report but [EMAIL PROTECTED] bogusified my report without the
 least bit of information.
 My script uses multiple includes and the file names all have the same
 syntax. So instead of writing each individual include, I created an
 array which contains all the filenames

 function LoadSections($sections)
 {
  foreach ($sections as $key = $value)
  {
   include mod.section. . $value . .php;
  }
 }
 instead of writing
 include file_x;
 include file_y;
 and so on

 All the files load well except that I cannot access HTTP_GET_VARS and
 the isset() function always return false (when they are inside the
included
 files).

 NB My includes work fine when loaded individually



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





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




Re: [PHP] http_get_var and isset() not working with script generated includes.

2002-11-18 Thread rija
Yep,
You need make global every variable used in yout include.
Maybe, you should declare-
GLOBAL $_GET ;

or do not call function to include your include
just do simply like this,

 foreach ($sections as $key = $value)  include mod.section. . $value .
.php;

- Original Message -
From: Moo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 15, 2002 7:55 AM
Subject: [PHP] http_get_var and isset() not working with script generated
includes.


 I wrote a bug report but [EMAIL PROTECTED] bogusified my report without the
 least bit of information.
 My script uses multiple includes and the file names all have the same
 syntax. So instead of writing each individual include, I created an
 array which contains all the filenames

 function LoadSections($sections)
 {
  foreach ($sections as $key = $value)
  {
   include mod.section. . $value . .php;
  }
 }
 instead of writing
 include file_x;
 include file_y;
 and so on

 All the files load well except that I cannot access HTTP_GET_VARS and
 the isset() function always return false (when they are inside the
included
 files).

 NB My includes work fine when loaded individually



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





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