Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8259239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:48:46+00:00 2026-06-08T02:48:46+00:00

When I include a page using it’s full URL (like include ‘http://mysite.tld/mypage.php’ ), I

  • 0

When I include a page using it’s full URL (like include 'http://mysite.tld/mypage.php'), I can’t use the $GLOBALS in mypage.php, it returns Undefined index error.

But when I include it using it’s relative path (like include 'mypage.php'), then it’s OK.

The reason why am I using URL instead of relative path is that I want to include $_GET parameters to mypage.php

Is there any logical explanation of this strange behaviour?


Note that both files are on the same server, in the same directory.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:48:47+00:00Added an answer on June 8, 2026 at 2:48 am

    Including files with a URL means the code is run as a separate process, which means it runs under a different variable scope. This is as opposed to if you include the file via a relative path, in which case it is pretty much equivalent to cut and pasting the code into the script.

    Essentially this means that the only variables available from your starting script are those that you explicitly pass (as you are in this case using the $_GET variables). This includes the $_SESSION variables, since the caller is your own server rather than the client.

    This behaviour is noted in the PHP manual’s include page:

    If the target server interprets the target file as PHP code, variables
    may be passed to the included file using a URL request string as used
    with HTTP GET. This is not strictly speaking the same thing as
    including the file and having it inherit the parent file’s variable
    scope; the script is actually being run on the remote server and the
    result is then being included into the local script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using require_once() in header.php to include the FirePHP library. In the page.php I'm
When i use php include to include a page in my website all the
I'm currently using include 'header.php' and include 'footer.php' in every page, and as far
I am making a multi-page form using http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/ . I want to include a
I'm trying to insert file into a page using Jinja 2.6 using the include
How to include loader image without usng AJAX controls like Scriptmanager, UpdateProgerss. Note: Page
How can I include a servlet page , in a JSF page. Is there
I am trying to include form on product page using renderPartial but it gives
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I use the following datepicker.php page for jquery datepicker is given below: <!DOCTYPE html>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.