hey Reecie, it's as Puck says, since it is not defined, it shows your 404.
if you want to make life easier, I would specify a folder
for inclusion files.
I call my folder "inc" and place all files in there.
<?
$thefile = "inc/$page.php";
if(isset($_GET['p'])){
$id = $_GET['p'];
}
else{
$id = 'home';
}
$page = $thefile;
if(file_exists($page)){
include $page;
}
else{
include("inc/home.php");
}
?>
If you want to secure the include files, add some php at the top:
<?
// keep people from accessing this page directly
if (eregi('home.php', $_SERVER['PHP_SELF'])) { // go to index page
header('Location: ../index.php?p=home');
die(); // stop page from executing
}
?>
<p> </p>
<h3>main Page</h3>
<p><strong>This is your page text!</strong></p>
I would create a .htaccess file & add that into your root directory.
In it, you would simply add the following directive:
ErrorDocument 404 /index.php?p=error404
(and make sure your error404.php is in the inc folder)
Sorry if this isn't exactly what you were chasing, but may be a better way to do what you are trying...