Getting URL Variables

triumph

69.***.***.***
1,422 days ago

Getting URL Variables

One thing I have been working with a lot lately is parsing URL variables.

Quick and easy:

Code:


$string1 = $_GET['Variable'];



Replace variable with whatever url variable you want to fetch and put into a string.

For example if your url was:

Code:


http://www.myurl.com/index.html?option=123



then you would use:

Code:


$option = $_GET['option'];



And whatever you put in the url for option would be in the $option variable.

penguinmama

12.***.***.***
1,418 days ago
That's nifty!

How would one know that should be $_GET ... is it automatically a GET if it isn't coming from a form labeled POST?