Re: Passing variable on include
| From: | Xongoo!com: Central unit | Date: | Sun, 29 Aug 2004 09:59:20 +0000 |
| Subject: | Re: Passing variable on include | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-195064@lists.php.net to get a copy of this message | ||
Duh, really, and just read on varianle scopes on
php.net. Gotta to sleep for some time :)
--
Tadas Talaikis
info@xongoo.com
http://www.xongoo.com
----- Original Message -----
From: "Marek Kilimajer" <lists@kilimajer.net>
To: "Xongoo!com: Central unit" <info@xongoo.com>
Cc: <php-general@lists.php.net>
Sent: Sunday, August 29, 2004 11:41 AM
Subject: Re: [PHP] Passing variable on include
> Xongoo!com: Central unit wrote:
> > Hi,
> >
> > I have to pass variable on include
> > include("includes/include.php");
> >
> > include("includes/include.php?name=$name");
> > wouldn't work.
> >
> > How do I do that? Cokies are not an option,
btw.
>
> Code in includes/include.php is executed in the
scope of the including
> file, so all variables available at the
include() will be available in
> the included file. Thus the solution is:
>
> $name = 'Your Name';
> include("includes/include.php");
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit:
http://www.php.net/unsub.php
>
>
>
>