PHP5 problem including pages

Miscellaneous Forums/General Discussion/PHP5 problem including pages

I am switching my server from php4 to php5. When I attempt to pass a variable in a link and include the page, php thinks the variable is undefined.

Link to php4 version of page:
http://www.leadwerks.com/index.php?page=purchase.htm

Link to php5 version of page:
http://www.leadwerks.com/index.php5?page=purchase.htm

My include code is like this:
<?PHP
include ($page);
?>

Try

include ($_GET[page]);


You are welcome.

I ran into the same kind of issues when a host friend of mine moved from 4 to 5... Along with LOTS of other issues.

But $_GET[page] is the proper variable for URL vars (OR Get vars)

and if you passed the data from a form with POST.. you guessed it $_POST[page] would be the proper variable.

Wanna save it to a session?

session_start();

$_SESSION[page] = url;


then load up a bunch of other random pages, call sesion_start again and then use $_SESSION[page] and it'll remember it. Easy peasy.

http://uk.php.net/manual/en/security.globals.php

I think they got rid of some depreciated stuff.

I use the $page=$_GET[page]; way of doing it on php5 and it works.

Incidentally, if you haven't already, you should really quote the value inside the square brackets.