Forum Moderators: coopster

Message Too Old, No Replies

How can I get the parameters that come after the link?

         

michal317

9:18 pm on May 31, 2006 (gmt 0)

10+ Year Member



Hi!
I don't remember how can I get just the parameters that come after the link. for example:
www.google.com?word=myword
I like to get just what is after the "?"

thanks!

eelixduppy

9:18 pm on May 31, 2006 (gmt 0)



You use the GET [us3.php.net] superglobal. Use the following:
echo $_GET["word"];

hughie

9:32 pm on May 31, 2006 (gmt 0)

10+ Year Member



the whole lot is obtained with $_SERVER['QUERY_STRING']

e.g for

google.co.uk?q=test&var=12

echo $_SERVER['QUERY_STRING']; // returns q=test&var=12

eelixduppy

9:37 pm on May 31, 2006 (gmt 0)



Or just using $_GET,an array, will get you everything too. So for everything:
echo "<pre>";
print_r $_GET;
echo "</pre>";