• In PHP we can create and use forms in which we need to use PHP superglobals $_GET and $_POST to get form data.
  • If the form request get or post we need to use $_GET, for post request $_POST to retrieve data from get request.
  • In this get request is the default form request in which the data is passed through get request is visible on the URL browser so it is not secured and we can send limited amount of data through get request.
  • Post request is widely used to submit form that have large amount of data such as image upload, file upload, registration form, login form, etc.
  • In this the data passed through post request is not visible on the URL browser so it is secured and we can send large amount of data through post request.

Sample Code

<html>
<body>

<form action="welcome_get.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html>

Output

Categorized in: