[thelist] PHP Includes Script

Dan Romanchik dan at danromanchik.com
Sun Feb 10 10:11:01 CST 2002


Kathryn (kathryn42 at hushmail.com) writes:

Hello ... I am trying to write a simple script using PHP but I find myself
very confused ... what I want is something like this:
if there is a querystring (like index.php?links) then grab the query, add a
.txt file extension, and include that file (like if there is the above
address, include links.txt)
otherwise, include default.txt

I think you're going about it wrong. What I'd do is check for the existence
of a query string. This is an Apache variable, $HTTP_QUERY_STRING. If this
exists, use the values in this string. (Actually, PHP already parses the
string for you and the values will be available in the array,
$HTTP_GET_VARS.) If $HTTP_QUERY_STRING is empty, then include default.txt.

Hope that helps!

Dan
----------------------------------------------------------------------------
Dan Romanchik - FreeAgent Writer, Editor,  and Web Developer
dan at danromanchik.com, 734-930-6564





More information about the thelist mailing list