What is proper way to process forms in http?
on /somepage:
<form method="POST" action="/someaction.html">
<input type="text" name="name">
<input type="submit">
</form>
Let’s assume, that user didn’t filled in “name”. So I should produce some error. How should I do it:
First method
- POST /someaction and 302 Redirect to /posterror?error=1
- GET /posterror?error=1 and 200 Ok with content about errors and form
Second
- POST /someaction and 200 Ok with content about errors and form
Third
- POST /someaction, remember in session form errors and 302 Redirect to /posterror
- GET /posterror and 200 Ok with content about errors and form
Which one is proper way? Maybe some fourth one?
The correct approach is called post/redirect/get and is described by wikipedia as: