Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why GET method can be used to submit the form data?

Tags:

rest

html

http

get

web

As we know, the form data in html can be submitted through GET method or POST method.
But in Http RFC, it is said that
In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval.

Then why can we submit form data to the server through GET method? Should GET method just be used to retrieval?

like image 907
Yu Gu Avatar asked Aug 03 '16 06:08

Yu Gu


People also ask

Can I send form data in GET method?

The form-data can be sent as URL variables (with method="get" ) or as HTTP post transaction (with method="post" ). Notes on GET: Appends form-data into the URL in name/value pairs. The length of a URL is limited (about 3000 characters)

What is the function of GET method in form?

The GET method is the method used by the browser to ask the server to send back a given resource: "Hey server, I want to get this resource." In this case, the browser sends an empty body. Because the body is empty, if a form is sent using this method the data sent to the server is appended to the URL.

Which method is used for form submitting?

The HTML <form> method Attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP methods, which are GET and POST. The method attribute can be used with the <form> element.

Is used to GET information from a form submitted using the GET method?

The Correct Answer is " Request.


1 Answers

You seem to be operating under the misconception that a form can't be used for information retrieval.

There are forms where the information entered by the user is used to decide what information to retrieve. The information isn't stored anywhere (at least not in a fashion that is significant, e.g. it might be logged).

An example of a form of this nature is the big one on the homepage of any search engine (like Google or Duckduckgo).

like image 124
Quentin Avatar answered Sep 22 '22 20:09

Quentin