It seems pretty simple but I can\'t find a good way to do it.
Say in the first page I create a variable
$myVariable = \"Some text\";
<
You could either embed it as a hidden field in your form, or add it your forms action URL
echo '';
or
echo '
Note this also illustrates the use of htmlentities and urlencode when passing data around.
If the data doesn't need to be passed to the client side, then sessions may be more appropriate. Simply call session_start() at the start of each page, and you can get and set data into the $_SESSION array.
Since you state your value is actually a filename, you need to be aware of the security ramifications. If the filename has arrived from the client side, assume the user has tampered with the value. Check it for validity! What happens when the user passes the path to an important system file, or a file under their control? Can your script be used to "probe" the server for files that do or do not exist?
As you are clearly just getting started here, its worth reminding that this goes for any data which arrives in $_GET, $_POST or $_COOKIE - assume your worst enemy crafted the contents of those arrays, and code accordingly!