POST vs GET method for a search form in CMS

Ondrej picture Ondrej · Sep 26, 2011 · Viewed 12.8k times · Source

I'm a bit stuck with one thing. Just can't make up my mind on whether to use POST or GET method at my search form.

Normally I would use GET method for such a form, so users could bookmark their results they got. But this time, the search form is present in administration area, so results are relevant shortly and there is no need to bookmark results and of course, they aren't public for everyone.

To be more specific, the search feature is meant to be used along with a list of users, so there could be some specific user to be searched. My idea was to use POST method, where the form would be redirected to the same page so I would get a list of users filtered by search string. There was also pagination, so I would add the search string at the and of each pagination link (next page, previous page, first page and last page link) so the search string wouldn't be lost later on (within any session coming after the search like paginating of searched results etc.).

There is no obvious reason to prefer one before another, both can be used. The POST method would be a little bit more hassle, but on the other hand, there are advanced options within the search form (about 5 checkboxes) and I don't like the idea of having meesed up URL bar with way too many values (and I expect users not to use pagination after search session so often, so the values wouldn't get to the address bar so often) if POST method used.

Which one would you prefer for searching in CMS and alike systems?

Thanks everyone!

Answer

Quentin picture Quentin · Sep 26, 2011

You are getting data, so use GET. POST will create issues with refreshing and going back.

Don't obsess over the beauty of your URIs, they are a tool not a piece of art.