Re: "include" question
| From: | Tom Rogers | Date: | Thu, 12 Dec 2002 14:21:24 +0000 |
| Subject: | Re: "include" question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127998@lists.php.net to get a copy of this message | ||
Hi,
Friday, December 13, 2002, 12:07:05 AM, you wrote:
R> Hello all,
R> I am passing a variable like so:
R> <a href="link.php?foo=bar.php">
R> On the "link.php" page, I have this simple code:
R> <?php
R> $job = $_GET['foo'];
R> echo "$job"; // for error checking
R> include 'path/to/$job';
?>>
R> The 'echo "$job";' statement works just fine, but the outbout for the
R> include statement looks like this:
R> bar.php
R> Warning: Failed opening 'scripts/$job' for inclusion
R> (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php
R> on line 142
R> Can I not use a $variable in an include 'something.php '; statement?
R> Thanks in advance,
R> Ron Clark
You have to use double quotes like:
include "path/to/$job"
or add like this:
include 'path/to/'.$job
--
regards,
Tom