dezkit Posted March 28, 2008 Share Posted March 28, 2008 is there a way i when i go to website.com/index.php?page=forum&ID=1 it goes to a different page then website.com/index.php?page=forum <?php $page = $_GET["page"]; if (!$page) { include "/site/forum.php"; } else if($page=="Forum") { include "/site/forum.php"; } else { echo "<b><h1>404 Error</h1></b>"; } ?> Link to comment https://forums.phpfreaks.com/topic/98385-phppageforumid1/ Share on other sites More sharing options...
dezkit Posted March 28, 2008 Author Share Posted March 28, 2008 anyone? ??? Link to comment https://forums.phpfreaks.com/topic/98385-phppageforumid1/#findComment-503525 Share on other sites More sharing options...
frijole Posted March 28, 2008 Share Posted March 28, 2008 <?php $page = $_GET["page"]; if (!$page) { include "/site/forum.php"; } else if($page=="Forum" && $ID == 1) {include "/site/whateverpageyouwant.php";} else if($page=="Forum") { include "/site/forum.php"; } else { echo "<b><h1>404 Error</h1></b>"; } ?> Link to comment https://forums.phpfreaks.com/topic/98385-phppageforumid1/#findComment-503569 Share on other sites More sharing options...
wildteen88 Posted March 28, 2008 Share Posted March 28, 2008 That wont work friojole if register_gloabls is not enabled! You'll be better of using: <?php if(isset($_GET['page'])) { switch($_GET['page']) { // url has ?page=forum case 'forum': // if url has the id present eg: ?page=forum&id=123 // then include another page if(isset($_GET['id']) && is_numeric($_GET['page'])) { include './site/whateverpageyouwant.php'; } // url does not provide the id, just include forum.php else { include './site/forum.php'; } break; // url has ?page=another_page // include another_page.php case 'another_page'; include './another_page.php'; break; // to add more more pages just do the same as above, eg: // url has ?page=one_more_page case 'one_more_page'; include './one_more_page.php'; break; // requested page is not found // display error default: die('<h1>404 Page not Found</h1>'); } } // page var not present display error else { die('<h1>404 Page not Found</h1>'); } ?> Link to comment https://forums.phpfreaks.com/topic/98385-phppageforumid1/#findComment-503629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.