Why isn't a PHP file passing values to a second INCLUDEd PHP file?

H M M M

New member
Running php 4.X on a shared server.

This SHOULD work, right?
FILE1:
$example = 'TestFIle.txt';
include 'http://myserver.com/file2.php';

FILE2:
$test2= 'xxxyyy';
echo $example; //should output contents to screen, but doesn't
if ($example== "") {
echo 'empty string';
}
$fp = fopen($example, 'a');
fwrite($fp, "{$test2}\n");

Now, when I run something like this, the $example is NEVER echo'ed to the screen, unless I do
it before and/or after the include in the first file. The second file, the included one that is called from the first file, NEVER shows $example to hold any contents. Why is this?!

Also, I get 'fclose(): supplied argument is not a valid stream resource' error messages unless the name of the file $example is defined IN the included second file.

I thought that values were passed to an included file from the file calling it. What's going on here?
 
Back
Top