+ Reply to Thread
Results 1 to 4 of 4

Thread: php includes and $_GET and $_POST variables.

  1. #1
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    php includes and $_GET and $_POST variables.

    Right this is a long question so here goes....

    index.php?page=blog&post=12&comment=yes

    This is a sample URL for something I want to do.

    index.php only uses the page variable to include the page - in this case blog.php,
    blog.php needs access to those get variables post and comment aswell as post variables.
    My question is this. If I called the above page how would blog.php get the extra URL gets? Would I use the standard $_GET[post] or would I need to use a duifferent method?

    Thanks

    lambada
    Lambada - the former Account Manager (before I resigned)




  2. #2
    Torch's Avatar
    Torch is offline x10 Lieutenant Torch is an unknown quantity at this point
    Join Date
    Apr 2006
    Location
    Belgrade, Serbia
    Posts
    317

    Re: php includes and $_GET and $_POST variables.

    Yes, if you have $_GET in blog.php that gets the variable from URL, it will work properly when you include it in another file.

  3. #3
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    Re: php includes and $_GET and $_POST variables.

    Wonderful! Thanks for that, now to weed some errors out of my code....
    Lambada - the former Account Manager (before I resigned)




  4. #4
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php includes and $_GET and $_POST variables.

    $_GET, $_POST, $_REQUEST, $_SESSION, $_SERVER, etc are all global variables, avaliable in all scripts, functions, objects, etc, even if included.
    Last edited by Bryon; 07-29-2006 at 01:36 PM.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers