Jump to content

What'd the setting for using GET variables without the _GET[] part?


hatrickpatrick

Recommended Posts

Strange problem... It seems that if I have a variable, say "board=9" in the URL, the file in question, (say threads.php?board=9) can use it as $board jusrt fine, but if that file, threads.php, includes header.inc.php, the header file has to cll it as $_GET['board'], $board isn't set... Is there a way to set this so the included files can also use the GET variable names, or will I have to just rewrite all my code which has this problem?  ???

Strange problem... It seems that if I have a variable, say "board=9" in the URL, the file in question, (say threads.php?board=9) can use it as $board jusrt fine, but if that file, threads.php, includes header.inc.php, the header file has to cll it as $_GET['board'], $board isn't set... Is there a way to set this so the included files can also use the GET variable names, or will I have to just rewrite all my code which has this problem?  ???

 

You mean the $_GET[] superglobal isn't visible to included files?

If variables are set without calling the get superglobal then u have register_globals on. Dont know whats the problem with included file as dont know how's your script written. If u have access to php.ini or a custom one in shared hosting, just turn it off as it will cause more problems then resolve. Better call it with $_GET and ure sure for your variables.

 

EDIT: From the php manual:

It's preferred to use superglobals, rather than relying upon register_globals being on.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.