Re: include result from script in midle of other script

From: Date: Sat, 14 Feb 2004 21:02:40 +0000
Subject: Re: include result from script in midle of other script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177717@lists.php.net to get a copy of this message
On Sat, 2004-02-14 at 15:46, Boneripper wrote: > <? if ($_SESSION['valores_relativos']) echo '<img > src="./5_grafico_total.php?aVar=aValue">'; > else include ("./5_grafico_total.php?aVar=aValue");?> Using include literally inserts the contents of the file into your code. One way to achieve what you are looking for is to set the variables you want to pass as a query string before including the script: if ($_SESSION['valores_relativos']) { echo '<img src="./5_grafico_total.php?aVar=aValue">'; } else { $_GET[aVar] = 'aValue'; include ("./5_grafico_total.php"); } If you rely on register globals you would want to set the variables directly like so: if ($_SESSION['valores_relativos']) { echo '<img src="./5_grafico_total.php?aVar=aValue">'; } else { $aVar = 'aValue'; include ("./5_grafico_total.php"); } -- Adam Bregenzer adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#177717) next »