Re: Using variables from includes

From: Date: Tue, 24 Jun 2003 22:37:32 +0000
Subject: Re: Using variables from includes
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-152670@lists.php.net to get a copy of this message
How would I do this then? "Leif K-Brooks" <eurleif@buyer-brokerage.com> wrote in message news:3EF8C813.6070601@buyer-brokerage.com... > Ben wrote: > > >Ok, I'm sort of a beginner at this, so cut me some slack. :-) Ok, I have an > >if then statement that after you click a link it looks like this: > >blah?page=pagename It looks something like this: > ><?php > >if(!$page) { > >include ("http://www.site.com/home.php"); > >} > >else{ > >include ("http://www.site.com/" . > >"$page" . ".php"); > >} > >?> > >This code is in the index.php file. When home.php is included, I want to > >echo a variable like $title on the index.php page. But $title is defined on > >home.php. For some reason, I can't get $title to echo on index.php after > >it's included. Anyone know?? > > > > > > > > > > > When you access it by HTTP, PHP has no way to get its variables. It > simply gets its output, just like a web browser. You need to include it > locally to use its variables. > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > >

« previous php.general (#152670) next »