Jest Posted February 14, 2007 Share Posted February 14, 2007 This is probably the simplest navigation script I've ever seen but it wont load past the default page. Heres a snippet. [code] <?php switch($id) { default: include('home.html'); break; case "contact": include('contact.html'); } ?> Link <a href="index.php?id=contact">Contact</a> [/code] Link to comment https://forums.phpfreaks.com/topic/38511-solved-include-i-must-be-retarted/ Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 And that's some ugly code. <?php switch($id) { default: include('home.html'); break; case "contact": include('contact.html'); } ?> That looks nicer. Now, out of personal preference I always do default last, but that's just my preference. The reason it's stopping is because of break. break will exit out of the switch. break Link to comment https://forums.phpfreaks.com/topic/38511-solved-include-i-must-be-retarted/#findComment-184776 Share on other sites More sharing options...
Jest Posted February 14, 2007 Author Share Posted February 14, 2007 I noticed the break 2 minutes before I read your post. But removed and with the default case at the end it still stays on the home page... Do you know a better way to do it besides Case and Switch? Link to comment https://forums.phpfreaks.com/topic/38511-solved-include-i-must-be-retarted/#findComment-184788 Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 One thing you may want to consider is, where does $id come from? I believe you're assuming register_globals is on, which is a very bad practice. Link to comment https://forums.phpfreaks.com/topic/38511-solved-include-i-must-be-retarted/#findComment-184790 Share on other sites More sharing options...
Jest Posted February 14, 2007 Author Share Posted February 14, 2007 I knew I forgot something... Thanks Link to comment https://forums.phpfreaks.com/topic/38511-solved-include-i-must-be-retarted/#findComment-184803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.