well there are two ways to do this , if i am understanding what you want.
one: using file_exists
http://php.net/file_exists
PHP Code:
<div class="body">
<?php
if(isset($_GET['page'])){
$page = $_GET['page'];
if(file_exists($page . ".html")){
include($page . ".html");
}else{
echo("This page is forbiddin");
die;
}
}else{
echo("This page is forbiddin");
die;
}
?>
</div>
or using switch
http://php.net/switch
PHP Code:
<div class="body">
<?php
$page = $_GET['page']
switch $page {
case "cats"
include ("cats.html");
break;
case "dogs"
include("dogs.html");
break;
}
?>
</div>
I wrote both quickly and may have errors
Bookmarks