xyn Posted August 8, 2006 Share Posted August 8, 2006 Hey,I have got my navigator on $_GET the problem with this is wheni call the exit; i lose everything else on the page below it. usuallymy copyright.I tried the following and it didn't work.[code=php:0]<?PHP$pg = $_GET['page'];if( !$pg ){ include("index.php"); break; } elseif( $pg == news ) { include("news.php"); break; } else { echo ' no such page'; break; } return;?>[/code] Link to comment https://forums.phpfreaks.com/topic/16903-break-return-help/ Share on other sites More sharing options...
wildteen88 Posted August 8, 2006 Share Posted August 8, 2006 Remove the break; and the return; they are not needed. if you are using an if/elseif/else statment. However it'll be better if you use a switch:[code=php:0]$pg = isset($_GET['page']) ? $_GET['page'] : 'home';switch($pg){ case 'home': include 'index.php'; break; case 'news': include 'news.php'; break; case default: echo "no such page"; break;}[/code] Link to comment https://forums.phpfreaks.com/topic/16903-break-return-help/#findComment-71179 Share on other sites More sharing options...
xyn Posted August 8, 2006 Author Share Posted August 8, 2006 cheers :] Link to comment https://forums.phpfreaks.com/topic/16903-break-return-help/#findComment-71208 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.