RE: [PHP] Defining PHP varibles from URL
| From: | David Freeman | Date: | Mon, 06 May 2002 10:18:33 +0000 |
| Subject: | RE: [PHP] Defining PHP varibles from URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96227@lists.php.net to get a copy of this message | ||
-----Original Message-----
I don't mean to be a pain but could someone send me a working example?
-----Original Message-----
This was replied to already by me and others. Didn't you read the
replies?
In any event, here's what I wrote last time...
-----Original Message-----
<script language="php">
$file = "";
//the above is defined from the url
include "$file";
</script>
It could be what I was typing in the url bar. file.php?file=foobar.inc
-----Original Message-----
Hmm, so you define $file in your url as "foobar.inc" and then, in the
page itself you take change $file to be "".
At least, that's how I'd read it. I'd suggest, it's not an overly good
idea to include a file like this as someone else has already mentioned.
In any event, your fix would have to be something like this:
<script language="php">
If (!isset($file) || empty($file))
{
$file = "some file";
}
Include "$file" ;
</script>
That way you're only going to over-write the contents of $file if it's
already either unset or empty.
CYA, Dave