I can't get include files to pick up variables from the "parent" script... like this: file1.php <? $state="illinois"; include('http://www.mysite.com/file2.php'); ?> file2.php <? echo $state; ?> It also doesn't work if i change the include url to: http://www.mysite.com/file2.php?state=$state, then do a GET on file2 to catch the parameter. Any ideas?
Just to add to that: 99.9% of the time, including via HTTP is wrong and won't work as expected. Well, it works as expected when you understand what is happening Always use filesystem paths unless you know WHY you're including via HTTP.
I think the second problem you may need to have: include('http://www.mysite.com/file2.php?state=.' echo $state; .''); PHP: Instead of: http://www.mysite.com/file2.php?state=$state
You can't do that, it will give an error. This would work though: include('file2.php?state=' . $state); PHP: