What is the difference between GET and POST methods in an HTML form?
Both are values of the method attribute of a form.
| Point | GET | POST |
|---|---|---|
| Data goes | In the URL | In the body of the request |
| Visible to user | Yes | No |
| Bookmark | Possible | Not possible |
| Size limit | Limited by URL length | Much bigger |
| Use for | Search, filters | Login, registration, file upload |
<form action="search.php" method="get">...</form>
<form action="login.php" method="post">...</form>
Never send a password with GET, because it stays in the URL and the browser history. See HTML Forms.
Learn more about the similar topics:
| Tutorials |
|---|
| HTML Input Types |
| HTML Forms |
| Exercises & Assignments |
|---|
| Write an HTML program to create a registration form |
| Write an HTML program to create a contact form |
| Interview Questions & Answers |
|---|
| What are the different new form element types in HTML5? |
| What is the difference between GET and POST methods in an HTML form? |
| What is the use of the label tag in HTML? |