SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question $HTTP_GET_VARS not accessible from within INCLUDEd code?

    I have run into this strange problem where i am not able to access $HTTP_GET_VARS from within a piece of code that itself is included in the the main index.php. I have to use $HTTP_GET_VARS because the host is running PHP 4.0.6
    What i do is include the content in the index.php frame using include_once(). This included code also needs to read some variables with $HTTP_GET_VARS. But it turns out it doesn't work, echoing the variable just returns nothing.
    The same code (using $_GET instead of $HTTP_GET_VARS) works flawless on a recent version of PHP.

    Could anybody give me a hint or is this a known issue in any way?

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I'm not 100% sure of the scope of included files but try adding this at the top of the include file
    PHP Code:
    global $HTTP_GET_VARS
    And see if that helps. I'd also pop off an email to the host, they should definiatly not be running a version that old.

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    Germany
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You hit the nail on the head, adding this to the included files allowed to access the variables. Thanks for the help DJ P@CkMaN!

    As for the host running this old server software, i totally agree. Its only a small host, and i didn't pick them. They said they don't update because they have other sites running there which would be broken then, true obviously. Well, they'd just need to deploy a new server, but its just a small host, so...

    But thanks to your help at least everything works for now


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •