From: "John Taylor-Johnston" <[EMAIL PROTECTED]> > I want to create a language option, so the resulting html is in French or English, depending. But passing variables like this doesn't work: > > <?php include ("../_phpcode/byname.php?lang=fr"); ?> > > echo $lang; // 'fr' > > Warning: main(): Failed opening '../_phpcode/byname.php?lang=fr' > for inclusion (include_path='.:/usr/local/share/pear') in > /home/users/q/qx04t9mu/www/.../parnoms.htm on line 125 > > It will work if I use a URL. > > <?php include ("http://foo.com/_phpcode/byname.php?lang=fr"); ?> > > echo $lang; // 'fr' > > Ideas on how to pass a variable?
include() code runs in the same scope as where you call include(). So you can do this. $lang = 'fr'; include('../_phpcode/byname.php'); and $lang will be available within the include file. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php