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

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
gregger14
Forum Newbie
Posts: 2
Joined: Sun Aug 28, 2005 6:50 pm

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

Post 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?
Stewsburntmonkey
Forum Commoner
Posts: 44
Joined: Wed Aug 24, 2005 2:09 pm

Post by Stewsburntmonkey »

The $_GET array will hold those arguments.

In that example $_GET['q'] is set to 1 . :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
gregger14
Forum Newbie
Posts: 2
Joined: Sun Aug 28, 2005 6:50 pm

thanks!

Post by gregger14 »

thanks
Post Reply