xyn Posted July 6, 2006 Share Posted July 6, 2006 Hi,I have my script which is attached below, I have it in the correct place on my Index.php page and I have the "exit;" code but this obviously exits the loading so I can't load the rest of the page to show my copyright and Links at the bottom.I'm basically wondering if anyone has any directional help they could offer me to swapping the exit; with break; and then at the bottom of the code i can return; the script. although when i last tried it I got parse errors.[code=php:0]<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="184"> <tr> <td width="100%" height="57" colspan="2"> <p align="center">Top</td> </tr> <tr> <td width="21%" height="93">Nav</td> <td width="79%" height="93"><?PHP $p = $_GET['page']; if( !$p ){ include "welcome.php"; break; } elseif( $p == action ){ include "page.php"; break; }else{ die('No such page'); } return; ?></td> </tr> <tr> <td width="100%" height="32" colspan="2"> <p align="center">copyright</td> </tr></table>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13830-breaking/ Share on other sites More sharing options...
wildteen88 Posted July 6, 2006 Share Posted July 6, 2006 Try a switch statment instead:[code=php:0]switch(@$_GET['page']){ case 'action': include "page.php"; break; default: if(!isset($_GET['page'])) { echo 'No such page'; } else { include "welcome.php"; } break;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13830-breaking/#findComment-53777 Share on other sites More sharing options...
xyn Posted July 6, 2006 Author Share Posted July 6, 2006 alright how do i add other pages into the switch? Quote Link to comment https://forums.phpfreaks.com/topic/13830-breaking/#findComment-53778 Share on other sites More sharing options...
heckenschutze Posted July 6, 2006 Share Posted July 6, 2006 Add more cases![code]switch(@$_GET['page']){ case 'action': include "page.php"; break; case 'mysecondaction': include "mysecondpage.php"; break; default: if(!isset($_GET['page'])) { echo 'No such page'; } else { include "welcome.php"; } break;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13830-breaking/#findComment-53781 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.