passing variable using require_once

Hi,

Does anyone know how I can pass a variable using require_once?

<?php @ require_once ("myfile.php?myvar=myvalue"); ?>

I don’t know if I’m using php in an unusual way. But I basically have an HTML file that I gave a .php extension to, so I could use the code above. I can get it to work without the variable. I tried _POST and _GET in the php file, but I can’t seem to read the variable.

Thanks in advance for any help,

-Jack

I don’t think you can do that. As far as I am aware, require_once is similar to include and effectively tells PHP to insert code from another file in its place. You would need to do something like this:

<?php $myvar=myvalue; require_once (“myfile.php”); ?>

and then the myfile.php code would need to look for the $myvar value rather than th$_GET value.

Does that make sense?

Cheers,

Gavin

^ Brilliant! Thanks man!