PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$id = isset($_GET['id']) ? $_GET['id'] : 'home';
if($id){
$id = isset($_GET['id']);
if (ctype_alnum($id)){
$file = "php/$id.php";
if(file_exists($file)){
include $file;
}else{
echo '<p class="center"> The page: <span class="bold">' . $id . '.php</span> you requested is unavailable at the present time please try refreshing the page or try again later, your error has been logged and the problem will be fixed shortly.</p>';
}
}else{
include 'php/home.php';
}
}
have used bits of everyones advice hope its decent let me know if you think its too messy.
if(isset($_GET['id'])){
$id = isset($_GET['id']) ? $_GET['id'] : 'home';
if (ctype_alnum($id)){
$file = "php/$id.php";
if(file_exists($file)){
include $file;
}else{
echo '<p class="center"> The page: <span class="bold">' . $id . '.php</span> you requested is unavailable at the present time please try refreshing the page or try again later, your error has been logged and the problem will be fixed shortly.</p>';
}
}else{
include 'php/home.php';
}
}