POST vs GET method for a search form in CMS

2019-04-19 23:32发布

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!

2条回答
仙女界的扛把子
2楼-- · 2019-04-19 23:45

Maybe, I would (mostly) always choose post over get, it's more tidy and refreshing and going back issues with post method are a thing from the past in any major browser, they just ask you if you want to resend the data, don't they?

The MAJOR exception would be bookmark of a dynamic webpage (like movieweb.com/movies.php?movie=the_three_mosqueteers, for example), but still, if that's not the case I think it's better to use POST.

查看更多
成全新的幸福
3楼-- · 2019-04-20 00:02

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.

查看更多
登录 后发表回答