SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Including variables

    I am sure there is an easy solution to this but I can't find it.

    I want to include a file, here is the code:

    First file:
    PHP Code:
    <?
    $id 
    "yes";
    $type1 "no";
    include(
    "comment.php?id=$id&?type1=$type1");
    ?>
    Comment.php:
    PHP Code:
    <?
    echo "$id and $type1";
    // this should output yes and no
    ?>
    For some reason I can't get it to ouput 'yes and no'

    Any suggestions will be appreciated
    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  2. #2
    SitePoint Guru OfficeOfTheLaw's Avatar
    Join Date
    Apr 2004
    Location
    Quincy
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's no reason to pass these variables as $_GET becase they exist in the global scope and are therefore accessible in the included file as it is included. I don't think you can pass get vars to an included file like you try to. (could be wrong, but doubt it).

    In this case, you may want to do without register globals too. Also, I don't really think this is such an advanced topic

  3. #3
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea i know its not advanced, i just posted it in the wrong catagory :/

    But you didnt really help me with a solution...
    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  4. #4
    SitePoint Evangelist DMacedo's Avatar
    Join Date
    May 2004
    Location
    Braga, Portugal
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What he meant was:
    remove the '?id=$id&?type1=$type1' from your include() and it'll work
    ~ Daniel Macedo


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
  •