Page 1 of 1

$_SERVER['QUERY_STRING'] Question.

Posted: Sat Jul 24, 2004 1:08 am
by Simon Angell
Hi all, just a quick one...
I am currently using $query=$_SERVER['QUERY_STRING']; to read the query string of a URL which is fine for one variable in the query string, however i now need it to work on this eg URL
http://www.whatever.com/script.php?this=query1&query2

how can i do it so this=query1 and query2 are seperate? Do i need to use $_GET??

Posted: Sat Jul 24, 2004 1:25 am
by ol4pr0

Code: Select all

#http://www.whatever.com/script.php?this=query1&query2 
echo $_GET['query1'];
#query 2 you might need some preg_replace/match .. if using it like that
#or 
#http://www.whatever.com/script.php?this=query1&this2=query2 
#than it would be
echo $_GET['this'];
echo $_GET['this2'];

Posted: Sat Jul 24, 2004 2:00 am
by Simon Angell
ahhh, ta awesome thx!!!