PHP Form Processing
PHP Hyper-Global variables $_get and $_post are used to collect form data (Form-data). $_get is an array of variables passed through the URL parameter to the current script. $_post is an array of variables passed through HTTP POST to the current script.
It's important to note that when working with HTML forms, PHP automatically turns form elements from HTML pages into PHP scripts for use. $_get Variable
A predefined $_get variable is used to collect values from a form that is method= "get".
The information sent from a form with a Get method is visible to anyone (it appears in the browser's address bar), and there is a limit to the amount of information sent. Example: form.html file code
When the user clicks on the "Submit" button, the URL sent to the server looks like this: http://www.runoob.com/welcome.php?fname=Runoob&age=3
The "welcome.php" file can now collect form data by $_get variables (note that the name of the form field automatically becomes the key in the $_get array):
Welcome to <?php Echo $_get["fname"];?>!<br>
your age is <?php echo $_get["aged"];?> .
When to use method= "get".
When you use method= "get" in an HTML form, all the variable names and values are displayed in the URL.
Note: This method should not be used when sending passwords or other sensitive information. Not safe
However, because the variable is displayed in the URL, you can bookmark the page in your Favorites folder. In some cases, this is useful.
Note: The HTTP get method is not suitable for large variable values. Its value cannot exceed 2000 characters. $_post Variable
A predefined $_post variable is used to collect values from a form in the method= "POST."
Information sent from a form with a POST method is not visible to anyone (not shown in the browser's address bar), and there is no limit to the amount of information sent.
Note: However, by default, the maximum amount of information sent by the POST method is 8 MB (can be changed by setting the post_max_size in the php.ini file). Example: form.html file code