HTML FORM methods

SumantSumant
1 min read

Types of method in html form:

  • GET

  • POST

WHAT IS THE DIFFERENCE IN THESE:

GET:

  • The common difference is that get method in little bit unsafe

  • create cache file

  • store data in history

  • Which can be access through history

  • it sends the data through url

    POST:

  • this method is safer

  • it sends the data to the request body which is a complete new page

  • all the logic is handled by the server side

  • this is secure as the data is not saved anywhere

  • directly the data is posted to the sever side by the request body

    ACTION:

    • action=”/signup”

    • route = url of the website

    • make easy to differentiate the data in the server side

    • eg. like you have two form one login and another signup then in which dB the data will go it is decided by the action or route

USE OF VALUE ATTRIBUTE:

  • the value attribute in input field helps a lot to server to distinguish the received

  • eg. if the user select the gender as “male” then if you don’t give the value in the input tag it will show gender as on not as male

0
Subscribe to my newsletter

Read articles from Sumant directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sumant
Sumant

👨‍💻 Learning Programming in Public 🚀 | Aspiring Full Stack Developer | Sharing Progress, Challenges & Growth | Let’s Code & Inspire Together! 💡