Skip to content Skip to sidebar Skip to footer

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'?

Solution 1:

$_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.

Solution 2:

var_dump( $_GET['key2'] );

Solution 3:

GET data is decoded into the $_GET super-global array. See http://php.net/manual/en/language.variables.external.php

Post a Comment for "How To Read The Query String In Php And Html?"