rswildy Posted April 9, 2007 Share Posted April 9, 2007 the current code is <?php if (!isset($_REQUEST['id'])) { include("pages/index.inc.php"); exit();}if ( $_GET['id'] == 1 ) { include("pages/index.inc.php"); }if ( $_GET['id'] == 2) { include("pages/another_page.inc.php");}?> Now if they type an ID that is invalid i would like it to redirect them to index.php for example ID or ID= and ID=number/word whatever so it only takes them to another page if the ID is valid so index.php?id=1 would work where index.php?id=11 wouldnt, Thanx, Rswildy. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 9, 2007 Share Posted April 9, 2007 Do a switch on the id. switch ($id){ case 1: //id is 1 break; case 2: //id is 2 break; ... default: //id is none of the above break;} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now