Newbie needs basic info about passing GET values in an URL

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
User avatar
steedvlx
Forum Contributor
Posts: 122
Joined: Wed Jun 11, 2003 10:54 pm
Location: Osaka, Japan

Newbie needs basic info about passing GET values in an URL

Post by steedvlx »

Hello,

I am struggling to learn PHP/MySQL and am working through some basic stuff. I have purchased several books, but cannot find this information in any of them.

What I need to do is to manually pass two parameters to a page using a link from my main page. What I cannot find anywhere is; What is the format for doing this?

I see this on my site--->> http://www.sgthost.com/japanese/j_searc ... select=101
AND, it works. (I've subsequently changed that to a POST BTW) :D However on another form, I need to pass both cat_select AND cat_select2 to provide a range of records to display rather then just a single category number.

Can anyone give me the correct URL format for this or point me to a good syntax resource for newbies?

Much appreciation
SteedVLX
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

Do you mean like
http://www.sgthost.com/japanese/j_searc ... elect2=102
?

Or did I miss the point?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

First, the file.

phpfile.php

A question mark tells the parser to process the file

phpfile.php?

.. and set a variable var=6

phpfile.php?var=6

..and another one, this=9

phpfile.php?var=6&this=9

..as many as you like:

phpfile.php?var=6&this=9&that=3&theother=text+works+as+well+as+numbers

In the phpfile.php code, you the variables are available as:

$_GET['var']
$_GET['this']
$_GET['that']
$_GET['theother']
..etc
User avatar
steedvlx
Forum Contributor
Posts: 122
Joined: Wed Jun 11, 2003 10:54 pm
Location: Osaka, Japan

Post by steedvlx »

Thank you both Paddy and McGruff.

You've made and old man very happy. I couldn't find an example anywhere since most everybody is using POST, I never get to see how it works. :)

That's exactly what I needed.
Post Reply