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. Link to comment https://forums.phpfreaks.com/topic/12197-query-strings-include/ 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 Link to comment https://forums.phpfreaks.com/topic/12197-query-strings-include/#findComment-46483 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] Link to comment https://forums.phpfreaks.com/topic/12197-query-strings-include/#findComment-46544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.