Forum Moderators: coopster

Message Too Old, No Replies

$http_server_vars['query_string'];

Guess what I get an error...

         

CIAimages

8:10 am on Mar 29, 2004 (gmt 0)

10+ Year Member



I am an ASP programer but one of my customer as a 2500 pages site and I have to converted into a PHP site because he wants to have it hosted on a linux server (I have no idea why but this is not the question)

I am trying to create a small script but I get an error on line 9 if I access the index.php file w/out any querystring
if I access "index.php?about" no problem
if I access "index.php" I get the error

error:
=======
Notice: Undefined index: QUERY_STRING in F:\Webfarm\SPI\index.php on line 9

Script:
=======
<?php
$page = $HTTP_SERVER_VARS['QUERY_STRING']; //line 9
if ($page==""){
include("pages/homepage.php");
}
elseif ($page=="about") {
include("pages/about.php");
}
elseif ($page=="contact") {
include("pages/contact.php");
}
else {
echo "Bad Boy, Bad Boy, What you gonna dooo. When they come for you!";
}
?>

Robber

9:38 am on Mar 29, 2004 (gmt 0)

10+ Year Member



Its probably because when there is no? there is no query string so the query string variable is not getting set. Perhaps test for this first using:

if(issset($HTTP_SERVER_VARS['QUERY_STRING'])){

}