http - Mixing GET with POST - is it a bad practice? -
Is it a bad practice to mix GET and POST? (Note that this is in PHP)
For example
There are simple rules: you are continuous things in the GET (possibly the URL parameters) that do not change the server, and post for posts that modify the server if there is something in your url parameter that you If you want to delete, then it will be bad practice.
Edit, year after year
I was asked for the source, so it is relevant http
There is a lot of speculation that the conference has been established that it should not be important to take the GET and HEAD methods to take action other than recovery. These methods should be considered "safe" / Strong> This may allow user agents to represent other methods, such as POST , in a special way, delete and delete, so that can be conveyed to the user that the potentially unsafe action is being requested.
There you go, GET should not change anything, the post is for something that changes the server (unsafe operation). I should be able to call for any time. It is more than idempotent: it should be (as much as possible) side-effect free!
If you have any form, you want to know whether you use GET or Post? Then the server => to change the post, do not get the server =>. And since any URL can be accessed (Receive or Post) with any action, do not keep the data that changes the URL in the URL, because someone can copy that URL, GET Can and change your server without Imagine what would happen that someone copied that URL to Facebook and 10 000 people started removing random things? Not good Recently the framework (node, ruby) is better than that, but not basic PHP, so it's a good rule of thumb for that language.
Comments
Post a Comment