What are the form method Attribute available for submitting?
The method attribute of the HTML <form> tag tells how the form data is sent to the server. There are two values: GET and POST. If you write nothing, the default is GET.
<form method="get" action="search.php">
<!-- fields -->
</form>
<form method="post" action="login.php">
<!-- fields -->
</form>
| GET | POST |
|---|---|
| Data goes in the URL (visible) | Data goes in the request body (not in the URL) |
PHP reads it from $_GET | PHP reads it from $_POST |
| Use for search and filters | Use for login, registration and changes |
The details are in difference between GET and POST and PHP Forms Handling.
Learn more about the similar topics:
| Tutorials |
|---|
| PHP Forms Handling |
| PHP Send Mail |
| PHP header() Function |
| PHP mail() Function |
| Exercises & Assignments |
|---|
| Create a PHP Form with 2 fields Name and Hobbies |