sydney28th 0 Report post Posted November 13, 2004 (edited) ~ Edited November 19, 2009 by sydney28th (see edit history) Share this post Link to post Share on other sites
chilipie 0 Report post Posted November 15, 2004 <?phpswitch($_GET['page']) { case "contact": include("contact.php"); break; default: include("home.php");}?> The default page is home.php, the contact page is contact.php. Add as many as you like, and then save the above code as index.php. To link to the pages - index.php?page=contact. Hope that helped, Ol. Share this post Link to post Share on other sites
Hercco 0 Report post Posted November 15, 2004 Chilipie did it 100% correct. But as this is a serious issue and I've seen this done in the web, I'd like to warn you.If you look at the code of the switch structure you can easily come up with an easier way to do it. Why to use switch when you could simply just send the page name as a get and include file based on the name.Like this include($_GET['page'].".php"); This works, but what if some one requests... http://yourserver.com/rg-erdr.php?_rpo=t So ALWAYS use a switch structure OR if include a file depending on GET parameter use a list for allowed files and check on every include. Share this post Link to post Share on other sites