Jump to content

Probably a simple include problem


jeffeh

Recommended Posts

            <?php

if ($page == "") $page = "home";

if (!file_exists($page.".php")) $page = "error";

include($page.".php");

?>

 

how come this isn't displaying the page whenever I use the url http://domain.com/index.php?page=page2

 

it is only displaying the home page, thanks!

Link to comment
https://forums.phpfreaks.com/topic/97752-probably-a-simple-include-problem/
Share on other sites

Probably something to do with your register globals setting.  Use this at the top of your script..

 

<?php
$page = isSet($_GET['page']) ? $_GET['page'] : NULL;
if ($page == "") $page = "home";
if (!file_exists($page.".php")) $page = "error";
include($page.".php");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.