[SOLVED] $_SERVER['QUERY_STRING'] Question.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Simon Angell
Forum Commoner
Posts: 45
Joined: Fri Jan 24, 2003 12:14 am

$_SERVER['QUERY_STRING'] Question.

Post 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??
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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'];
Simon Angell
Forum Commoner
Posts: 45
Joined: Fri Jan 24, 2003 12:14 am

Post by Simon Angell »

ahhh, ta awesome thx!!!
Post Reply