The PHP built-in $_GET function is used to collect values in a form (as name says, you do this with the method=”get”) You should remember that the information sent from a form with the GET method is visible to everyone, because the result is displayed in the address bar.
The $_GET function limits the number of characters to be send (max. 100 characters.)
<html> <body> <form action="test.php" method="get"> Your name: <input type="text" name="yourname" /> <input type="submit" /> </form> </body> </html>
When the user clicks on submit, an URL is sent to the server that will look something like this:
Warning: as you can see you can read the input text. That’s why you should be careful with $_GET function. For example you should never use a GET method in a login form.
But it can also be useful to see what the content is of the variable. Because the variables are displayed in the URL, you can for example bookmark the page. Just an example, but you should be careful with the get method.