ive always done it like this:
code:
<?php
$page = htmlentities($_GET['page']) ;
if (!isset($_GET['page'])) {
include ("home.php");
}
else {
$filename = "pages/$page.php";
if (file_exists($filename)) {
include("pages/$page.php"); }
else {
echo "Sorry, The Page Cannot Be Found";}
}
?>