Jump to content

Using the Switch Statement Issue...


phpSensei

Recommended Posts

This is my index page for my site...

 

<?php

$action=$_GET['page'];

switch($action){

case '':
index();
break;

case 'view_comments':
echo "here be comments";
break;

}
?>

 

My issue is that when ever a user enters something like this www.localhost.com/?page=dssdasdasdasd,

 

As you can see the "asasasas" is a random string which doesnt exist in my switch statement....

 

HOW can I show an error message for whenever the page doesnt exists?

 

Please try to understand.

Link to comment
https://forums.phpfreaks.com/topic/62931-using-the-switch-statement-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.