A
A
AhAnya2014-07-16 13:06:58
HTML
AhAnya, 2014-07-16 13:06:58

What are the features of using POST and GET?

Good afternoon! At the moment I am learning the basics of HTML and CSS, as I read the book, a lot of questions arise. One of these questions appeared in the section "HTML forms" and so, I decided to ask the professionals - please explain to a beginner when to use POST and when GET? What is the difference?
PS Since I'm completely new, it is desirable to explain with examples and in an accessible language.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
Dmitry Entelis, 2014-07-16
@AhAnya

Colleagues, the author asked not about that.
And about the cases - when the form needs to be submitted via POST, and when via GET.
We asked - we answer.
You need to understand that GET submitting a form is essentially just opening a page with a URL in which the GET parameters are specified. POST is transmitted in the body of the request and is not visible to the average user.
Accordingly, cases when the form needs to be sent via POST
1. If you have an input type=file field
2. If you have large text fields
3. If you do not want the user to see the parameters that went to the server
Cases when it is better to send the form via GET
1. When the user should be on a page with a url in which the parameters of the submitted form are visible.
2. If you do not want a question about the form to be displayed when trying to update the final page.
3. ... couldn't think of it :)

R
Roman Zhak, 2014-07-16
@romanzhak

www.komtet.ru/lib/tech/apache/razlichie-mezhdu-met...

A
Alexander Borisovich, 2014-07-16
@Alexufo

https://www.google.ru/search?q=POST+and+GET+distinctions#n...

O
OnYourLips, 2014-07-16
@OnYourLips

Why didn't you want to read the RFC over HTTP, which says. when to use each method.

D
DjoNIK, 2014-07-16
@DjoNIK

By the way, yes. For a long time I do not have a clear understanding of where which of the methods to use (fortunately, I do not specialize in the web).
In my understanding, GET is more intended to receive some kind of data (what kind - it specializes in the address bar and is customized by the passed parameters), plus, GET is more frivolous (there is no overhead for additional headers). POST is intended for sending some data; there is a wider range both in data type (in addition to text, it is easy to transfer binary ones) and in volume (GET is greatly curtailed in this regard).
But what might be needed in the classic form of method="get"? After all, the form always (!) implies sending information. However, there is such a possibility. Or is it just a misuse of the means we shoot ourselves in the foot with?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question