View Full Version : Distinguishing data on URL data passing
I need to pass a URL string from one page to another, eg:
http://server/page.php?redir=http://server/anotherpage.php
...that works fine, but when there is more data involved things go a little strange:
http://server/page.php?redir=http://server/anotherpage.php?somedata=1&somemoredata=2
How can you distinguish to which page 'somemoredata' belongs to?
Nightfire
09-14-2002, 12:24 AM
if($somemoredata =="2"){
include("moredate.php");
}
downsize
09-14-2002, 10:42 AM
coming from a compiled backgroun, debugging appears to be rudimentary in the web application world.
what I like to do when I am uncertain or need to debug what I think should be there and is not, is use var_dump.
depending on my application, I include a debug.inc which contains (one of many) function:
function takealook($var, $desc="desc "){
print "<pre> $desc ";
var_dump($var);
print "</pre>";
}
so my point is, examine the $_SERVER object. It has the arguments so you could check to be sure that:
somedata is equal to 1 and somemoredata is equal to 2.
now, you might have this solved and could care less about my input or maybe you know this already but using that function or just straight write:
takealook($_SERVER, "_SERVER object info whatever ");
or manually
print "<pre> _SERVER object info whatever ";
var_dump($_SERVER);
print "</pre>";
hopefully it will help you out and speed up your debugging process.
Nightfire, I am not too sure what you are doing, please explain.
Thanks for that advice downsize.
Dylan Leblanc
09-17-2002, 11:18 PM
Exd, you need to 'escape' the second "?" and the "&" in the second URL you gave there. I dont know exactly how that should be done in URL's, but you might be able to find some info about this at w3.org.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.