Pass value to an include file in php.

Posted by Muhammad Sajid on Stack Overflow See other posts from Stack Overflow or by Muhammad Sajid
Published on 2010-04-15T09:44:43Z Indexed on 2010/04/15 9:53 UTC
Read the original article Hit count: 189

Filed under:

Hi,

How do you pass a parameter into an include file? I tried the following but it doesn't work.

include "myfile.php?var=123";

and in myfile.php, I try to retrieve the parameter using $_GET["var"].

include "myfile.php?var=123"; will not work. PHP searches for a file with this exact name and does not parse the parameter

for that I also did this:

include "http://MyGreatSite.com/myfile.php?var=123";but it does not also work.

Any hints? Thanks.

© Stack Overflow or respective owner

Related posts about php