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?  ???

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.