JJBlaha Posted March 1, 2007 Share Posted March 1, 2007 This is my issue, simplified down. http://sub.domain.com/page1.php <?php include('http://www.domain.com/main/page2.php'); ?> http://www.domain.com/main/page2.php <?php echo "Test is "; echo $_GET['test']; ?> http://sub.domain.com/page1.php?test=test returns Test is And if i change page1.php to http://sub.domain.com/page1.php <?php echo "Test is "; echo $_GET['test']; ?> http://sub.domain.com/page1.php?test=test returns Test is test What is going on? Quote Link to comment Share on other sites More sharing options...
btherl Posted March 2, 2007 Share Posted March 2, 2007 You can't use include() for that. You should use readfile() instead. To preserve the $_GET variables, you will need to explicitly add them to the readfile() call, like this: readfile('http://www.domain.com/main/page2.php?test=test'); As for doing that in practice, you can hardcode it if you only expect a fixed set of $_GET variables. Otherwise you can use a foreach loop to add each $_GET variable. 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.