Page 1 of 1

page.php?q=1 -- how do you do this?

Posted: Sun Aug 28, 2005 6:55 pm
by gregger14
This is probably a simple question, but how do you pass parameters to a script (page.php) in this fashion?

Code: Select all

<a href="page.php?q=1">page</a>
and reference their values inside of page.php?

Posted: Sun Aug 28, 2005 6:58 pm
by Stewsburntmonkey
The $_GET array will hold those arguments.

In that example $_GET['q'] is set to 1 . :)

Posted: Sun Aug 28, 2005 7:00 pm
by Chris Corbyn

Code: Select all

echo $_GET['q'];
They all get stored in a superglobal called $_GET which is an array accessible from anywhere. Don't forget to urlencode() strings you'll use in the URL ;)

It's all explained in the manual during the tutorial on PHP.net

thanks!

Posted: Sun Aug 28, 2005 7:04 pm
by gregger14
thanks