Advantages and disadvantages of sending variables by POST method

The most common use of a form with post method is to send data that will be stored in a database, or that will cause operations that enable access to private data (with a form of access to a private area, or registration).

Advantages and disadvantages of sending variables by POST method | Learn PHP | The most common use of a form with post method is to send data that will be stored in a database, or that will cause operations that enable access to private data (with a form of access to a private area, or registration)

The most common use of a form with post method is to send data that will be stored in a database, or that will cause operations that enable access to private data (with a form of access to a private area, or registration).

Advantages?

  • One of the potential advantages of declaring in our form that the post method be used, is to get our browser to connect to the server and send the data of the form fields in an absolutely invisible, discreet way, at least in the address bar of the browser
  • Of course, that makes it difficult to modify the address bar to send extra data that allows the get method, but nothing prevents a "curious" user from editing the form on your computer, and sending unexpected data to the server also using the post method
  • Unlike the get method, the data sent by the post method does not have a limit regarding the number of variables sent in the same request, or the length of their values

Disadvantages? Many:

  • If the access to a page depends on the sending of data to the server using the post method, every time we want to return to this page we must send again the form data, and most browsers will warn this with a warning message to the user , who will not always understand what is happening
  • Another disadvantage: if the user saves a page in his favorites that received data by post, when he uses that favorite, the data he sent the first time from a form will no longer be available and, therefore, the result he will obtain will no longer be available. it will be the same (or you will get the typical alert message)

We return to reaffirm the conclusion that maintains that to send private information, we will use post; to browse public information, we'll use get.

And we'll also use get when we want our page to be saved in the user's favorites without causing usability problems.

Did you like it or was it useful?

Help us share it in Social Networks

Professor at the University of Guadalajara

Hugo Delgado Desarrollador y Diseñador Web en Puerto Vallarta

Professional in Web Development and SEO Positioning for more than 10 continuous years.
We have more than 200 certificates and recognitions in the Academic and Professional trajectory, including diploma certificates certified by Google.

IT ALSO DESERVES TO PAY TO VISIT:

Not finding what you need?

Use our internal search to discover more information
Sponsored content:
 

Leave your Comment

SPONSOR

Your business can also appear here. More information