Page 1 of 1
include using $QUERY_STRING
Posted: Mon Sep 08, 2003 7:05 am
by Swaroop
Code: Select all
$pagetitle="$QUERY_STRING";
if (!empty($QUERY_STRING)) {
$thefile = "$QUERY_STRING.php";
if (file_exists($thefile)) {
include("functions.php");
include("top.php");
include($thefile);
include("bot.php");
exit;
}
$thefile = "$QUERY_STRING.php";
include("functions.php");
include("top.php");
include("Error404.php");
exit;
}
$pagetitle="Home";
include("functions.php");
include("top.php");
include("Home.php");
include("bot.php");
Ok now everything's fine..
The trouble is when I access like
/?Page?somevar=somevalue then it takes it as an error page of course.. Can someone give a suggestion to alter this so that using the same technique, I can send variables thru QUERYSTRING ??
Thanks,
Swaroop

Posted: Mon Sep 08, 2003 7:52 am
by Nay
/?Page?somevar=somevalue
it should be:
/page.php?somevar=somevalue
or....
(it's either my limited knowledge or your tying error or something. i think you would need to use it like:)
/?somevar=somevalue
most of the time, it won't work unless the file is index.php since like this, it looks for the index file in the directory.
hope that helps.
-Nay
Posted: Mon Sep 08, 2003 8:31 am
by JAM
Recommend you read the last link in my signature...
($_SERVER['QUERY_STRING'])
Posted: Mon Sep 08, 2003 11:00 am
by m3rajk
/? only works on the index. /?page=1 sets a variable page to 1
/?page=1&somevar=zxy sets page to 1 and somevar to zxy
/?page=1?somevar=zxy sets page to 1 (or maybe 1?somevar=zxy)
Posted: Tue Sep 09, 2003 5:02 am
by Swaroop
well it's something like this :
/?Page --> includes the file Page.php from the parent directory..
Now when I wanna pass the variables, I have been using /Page.php?somevar=somevalue which gives me a problem cuz functions.php and top.php must be included for all the pages.
So what I am asking is like can we pass a variable also using this technique which i use for my pages ??
example:
/?Page?somevar=somevalue
OR
/?Page&somevar=somevalue
--
Swaroop
