Page 1 of 1

Newbie needs basic info about passing GET values in an URL

Posted: Wed Jun 11, 2003 10:54 pm
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

Posted: Wed Jun 11, 2003 11:15 pm
by Paddy
Do you mean like
http://www.sgthost.com/japanese/j_searc ... elect2=102
?

Or did I miss the point?

Posted: Wed Jun 11, 2003 11:31 pm
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

Posted: Wed Jun 11, 2003 11:53 pm
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.