How do i set the variable that the $_GET
function will be able to use, w/o submitting a form with action = GET
?
PHP $_GET is a PHP super global variable which is used to collect form data after submitting an HTML form with method="get". $_GET can also collect data sent in the URL. When a user clicks on the link "Test $GET", the parameters "subject" and "web" are sent to "test_get.
These are superglobals, which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special. 3) $_GET is an array of variables passed to the current script via the URL parameters.
Syntax: $variable = "value"; $$variable = "new_value"; $variable is the initial variable with the value. $$variable is used to hold another value.
$_GET
contains the keys / values that are passed to your script in the URL.
If you have the following URL :
http://www.example.com/test.php?a=10&b=plop
Then $_GET
will contain :
array
'a' => string '10' (length=2)
'b' => string 'plop' (length=4)
Of course, as $_GET
is not read-only, you could also set some values from your PHP code, if needed :
$_GET['my_value'] = 'test';
But this doesn't seem like good practice, as $_GET
is supposed to contain data from the URL requested by the client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With