Re: Passing variable on include

From: Date: Sun, 29 Aug 2004 08:41:31 +0000
Subject: Re: Passing variable on include
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195058@lists.php.net to get a copy of this message
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");

« previous php.general (#195058) next »