Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read the query string in PHP and HTML?

a URL ending with something like portal.php?key2=hello how can I get the value of "key2"?

like image 837
Ahmad Farid Avatar asked Nov 11 '10 10:11

Ahmad Farid


1 Answers

$_GET['key2']

will get you the value from a query string.

$_POST['key2']

will get you the value from a form posted.

$_REQUEST['key2']

will get you either of the above if it exists.

like image 134
Gav Avatar answered Oct 06 '22 23:10

Gav