HTML FORM methods

·

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