You use post for larger amounts of data, or data that you don't want to appear within the url. For instance, you don't want the url to delete a page, or create one, to appear in someones history. Neither do you want to save passwords in this way.
For search strings and such, you can easily use get. It allows users to copy a specific url, like a specific search reasult, or a link to the 5th page in a paginated list.
So, either are ok for their own purposes. The only thing you should remember is the maximum size of 8Kb for an url, including the get parameters.
Short answer:
Use GET
requests when it makes sense for the user to be able bookmark the request, share the request, and come back to over and over again. It makes sense to be able to bookmark the result of a Google query, for example.
Longer answer:
Use GET
requests when the user is simply fetching/viewing a resource, and doesn't have any significant side-effects on your website's data or on future requests. If the request is creating, modifying, or deleting something, it should be a POST
. If the user is logging in to a website, that has effects on future requests, so it should be a POST
, not a GET
.
Note: Users can still change POST
variables.
It's easier to for the user to change query string (GET
) values, but it's not too difficult for the user to change POST
values. Your website's security should take this into account! Using POST
for security isn't really a valid reason, except for the fact that POST
variables aren't part of the URL and aren't bookmarked, while GET
variables are. This prevents users from accidentally sharing things like passwords when sharing links.
GET is better for things that should be able to be bookmarked, and simple queries with few, short parameters.
POST is better for sensitive fields that the user shouldn't see, for large binary transfers, and for transfers with many fields or very long fields.