Php switch Case Why wont my Default page trigger when wrong url is enter

duvanickaf

New Member
Hi I'm working on a page switch code, the default page does not seem to load for some reason can anyone help? at the moment I can enter a random URL but it just shows page not found.the default show be triggering to the PHPMyAdmin page error
which is the \[code\]views/404.php\[/code\] folder.
but it doesnt. I can seem to understand why it doesnt. \[code\]<?php//begin the webpage//index page selector placed into an array for options for the user to select//session started recording attributessession_start();error_reporting(0);//including other view class and model class function to be used on this pageinclude 'views/viewClass.php';include 'classes/modelClass.php';class PageSelector { public function run() { //has the user decided which page to go to? //if not then we will direct him to the homepage if(!$_GET['page']) { $_GET['page'] = 'Home'; } //extending a new model class $model = new Model; //get the page information $pageInfo = $model -> getPageInfo($_GET['page']); //select which page to include when the user clicks //on either register/home/my account/my bids/my sell/completed auctions/edit etc..etc..etc.. switch($_GET['page']) { case 'Register': include 'views/register.php'; $view = new HomeView($pageInfo, $model); break; case 'Home': include 'views/homeView.php'; $view = new HomeView($pageInfo, $model); break; case 'My Account': include 'views/myaccount.php'; $view = new myaccount($pageInfo, $model); break; case 'My Bids': include 'views/mybids.php'; $view = new Mybids($pageInfo, $model); break; case 'My Sell': include 'views/mysell.php'; $view = new mysell($pageInfo, $model); break; case 'Completed Auctions': include 'views/checkout.php'; $view = new checkout($pageInfo, $model); break; case 'editProduct': include 'views/editProductView.php'; $view = new EditProductView($pageInfo, $model); break; case 'addProduct': include 'views/addProductView.php'; $view = new AddProductView($pageInfo, $model); break; case 'deleteProduct': include 'views/deleteProductView.php'; $view = new DeleteProductView($pageInfo, $model); break; case 'deleteUser': include 'views/deleteUserView.php'; $view = new DeleteUserView($pageInfo, $model); break; case 'search': include 'views/search.php'; $view = new search($pageInfo, $model); break; case 'product': include 'views/productView.php'; $view = new ProductView($pageInfo, $model); break; default: include 'views/404.php'; $view = new error($pageInfo,$model); } echo $view -> displayPage(); } }$pageSelect = new PageSelector();$pageSelect -> run();//calls the selector to run after user has selected.\[/code\]
 
Back
Top