Please can someone explain the difference(s) between GET and POST in html forms | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please can someone explain the difference(s) between GET and POST in html forms

Tried googling. Info there were too advanced for a beginner like me

28th Jun 2018, 1:53 PM
Emeruche Ikenna Cole
Emeruche Ikenna Cole - avatar
4 Answers
+ 1
Your browser talks using http (that's why you see http:// and https:// in the address bar when visiting a website). http knows different methods, like GET, POST, PUT, PATCH, HEAD, ... If you send a GET request to a website like www.example.com you will get a response, if you send a POST request to the same website you might get a very different response. So a html form just gives you the option to switch the http method if the other end (whatever is written in <form action="...) expects something other than GET. Typically you will use POST if something will change on the server (you log in or create a user, you update a database...) and GET for things that don't (you want to visit the website, or read from a database). Another obvious thing is that if you send things with GET, all the html form data will be appended to the url after the ?, like www.example.org/?user=Cole&password=1234 which can be a bad idea. In this example you should be using POST, which hides the form data (the password) somewhere else.
28th Jun 2018, 2:07 PM
Schindlabua
Schindlabua - avatar
+ 2
GET parameters are part of URL so there are visible, POST parameters are in the HTTP request. https://www.w3schools.com/tags/ref_httpmethods.asp Here is a simple comparison : https://www.diffen.com/difference/GET-vs-POST-HTTP-Requests
28th Jun 2018, 2:00 PM
Simon
Simon - avatar
+ 1
Donna I tried searching it. Couldn't find it.
28th Jun 2018, 2:20 PM
Emeruche Ikenna Cole
Emeruche Ikenna Cole - avatar
28th Jun 2018, 2:01 PM
Calviղ
Calviղ - avatar