RE: [PHP] include option and calling only part of a file.

From: Date: Sun, 29 Dec 2002 05:29:14 +0000
Subject: RE: [PHP] include option and calling only part of a file.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-129572@lists.php.net to get a copy of this message
> I have one file with several sections of code which I have so far > accessed using a good old fashioned - - if ($HTTP_GET_VARS['action'] == > "Update") - - however I now want to include this code within some other > web pages, I thought I may be able to use the following code - - > include("/modules.php?action=Update") - - however the code does not run. > Hoping someone can help me out on a way to overcome this. I am running > IIS 5, and PHP 4.2.3 When you include() a file, it has the same variable scope as the file it was included from. So, if you have the following code: $action = "Update"; include("modules.php"); Then you can use $action in modules.php and it'll be set to "Update". modules.php will have the same variables as the file that included it. I hope that helps... ---John Holmes...

« previous php.general (#129572) next »