After processing form from POST I should redirect, to prevent user from hitting back. However, I am using form to determine search query on a database, so I need to either pass params to the redirected site or the result of a search. Or maybe there is some other good practice, how to solve this problem? Maybe in this situation I am allowed not to redirect (nothing happens, if user performs search again).
+2
A:
Search queries should probably be GETs, rather than POSTs, because they are not changing anything - they are simply passing parameters to get certain information. POST should be reserved for forms that actually change things in the database, or result in a specific action (eg submitting an email).
To reply to your comment, hiding parameters from URLs is not particularly good practice, but if you really think you need to, this is an instance where it's OK not to redirect after the form submission - again, because you're not affecting anything with the POST.
Daniel Roseman
2010-03-17 10:25:40
What if I didn't want to pass params through url and hide them? What can I do then?
gruszczy
2010-03-17 10:44:36
See my edit above.
Daniel Roseman
2010-03-17 11:15:18
Ok, thanks a lot for the answer. I'll go with GET.
gruszczy
2010-03-17 11:20:33