jdock1 Posted May 30, 2009 Share Posted May 30, 2009 Im still a noob in PHP & got a rather stupid question. Many sites running php use pretty much one php file for everything. For example, a site uses index.php for everything. There are other pages defined as index.php?id=1 & index.php?id=2 etc. Ive been trying code out and cant really do it all that well. Could somebody explain this for me? Thanks Link to comment https://forums.phpfreaks.com/topic/160310-how-to-make-multiple-pages-through-one-file/ Share on other sites More sharing options...
PugJr Posted May 30, 2009 Share Posted May 30, 2009 Which do you want to know? The formal or the latter? If the first, have this code in all your pages. include("stuff.php"); Link to comment https://forums.phpfreaks.com/topic/160310-how-to-make-multiple-pages-through-one-file/#findComment-845976 Share on other sites More sharing options...
marcus Posted May 30, 2009 Share Posted May 30, 2009 The whole index.php?id= thing is using the GET method. <?php $id = $_GET['id']; switch($id){ case 1: include "page1.php"; break; case 2: include "page2.php"; break; default: include "home.php"; } ?> Link to comment https://forums.phpfreaks.com/topic/160310-how-to-make-multiple-pages-through-one-file/#findComment-845981 Share on other sites More sharing options...
jdock1 Posted May 30, 2009 Author Share Posted May 30, 2009 The whole index.php?id= thing is using the GET method. <?php $id = $_GET['id']; switch($id){ case 1: include "page1.php"; break; case 2: include "page2.php"; break; default: include "home.php"; } ?> uhh thats it thanks. I knew that, but I didnt know to use switch Link to comment https://forums.phpfreaks.com/topic/160310-how-to-make-multiple-pages-through-one-file/#findComment-845982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.