SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I have a annoying problem with include paths, when I try this:
    PHP Code:
    <?
    include("index.php?page=links&id=7");
    ?>
    but when I do this:
    PHP Code:
    <?
    include("index.php");
    ?>
    this works fine.
    So It isn't possible to include files with some variables.
    Any suggestions to do this yet???

  2. #2
    SitePoint Zealot cokeman's Avatar
    Join Date
    Dec 2000
    Location
    So. California
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think you can add parameters to an include path as you would in a URL.

    You could try
    PHP Code:
    <?
    $page
    ="links";
    $id=7;
    include(
    "index.php");
    ?>

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes as cokeman said there is no reason you would need to pass vars to an include file, since include() simply pulls the page into your script exactly where you put the include() function. So any vars created or used in the orginal script will be accessible within the included file.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thank you guys!


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
  •