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 Quote Link to comment 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"); Quote Link to comment 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"; } ?> Quote Link to comment 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 Quote Link to comment 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.