php includes and $_GET and $_POST variables.

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
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
 

Torch

New Member
Messages
634
Reaction score
0
Points
0
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.
 

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
Wonderful! Thanks for that, now to weed some errors out of my code....
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
$_GET, $_POST, $_REQUEST, $_SESSION, $_SERVER, etc are all global variables, avaliable in all scripts, functions, objects, etc, even if included.
 
Last edited:
Top