Guest Posted June 16, 2006 Share Posted June 16, 2006 Hey,Just a thought-I thought it might be useful if true: Can include (and its require counterpart) pass $_GET variables through to the page it's including, say:[code]include('header.php?page=12');[/code]Thanks. Quote Link to comment Share on other sites More sharing options...
joquius Posted June 16, 2006 Share Posted June 16, 2006 no, include does not load the page it just inserts the code for processing on the same page, but if the $_GET was set in the page holding the include(); function it would affect the included file in the same manner Quote Link to comment Share on other sites More sharing options...
poirot Posted June 17, 2006 Share Posted June 17, 2006 Giving you an example; if you have a file called "header.php":[code]<?phpecho 'Page: ' . $_GET['page'];?>[/code]Now if you access header.php?page=12 it will print out:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Page: 12[/quote]But if you have another file, called another.php:[code]<?phpinclude 'header.php';echo 'Included!';?>[/code]And access another.php?page=15, it will print:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Page: 15Included[/quote] 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.