The Little Guy Posted October 27, 2008 Share Posted October 27, 2008 is it possible to send get values through an include? Example: include '../incl/myfile.php?section=section2'; Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/ Share on other sites More sharing options...
Jeremysr Posted October 27, 2008 Share Posted October 27, 2008 Not like that, but this will do what you want: $_GET['section'] = 'section2'; include '../incl/myfile.php'; Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/#findComment-675377 Share on other sites More sharing options...
kenrbnsn Posted October 27, 2008 Share Posted October 27, 2008 No. Any variables you set before doing the include will be available inside the included file. Ken Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/#findComment-675379 Share on other sites More sharing options...
The Little Guy Posted October 27, 2008 Author Share Posted October 27, 2008 but then section will always be equal to section2 and nothing else? Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/#findComment-675381 Share on other sites More sharing options...
kenrbnsn Posted October 27, 2008 Share Posted October 27, 2008 When you include a file, it is just like you wrote the code in-line. The $_GET array will be available to the code. Ken Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/#findComment-675387 Share on other sites More sharing options...
The Little Guy Posted October 27, 2008 Author Share Posted October 27, 2008 Thanks guys! Link to comment https://forums.phpfreaks.com/topic/130224-solved-include-get/#findComment-675394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.