In my MVC structure, I sometimes redirect after submitting the form. Let's say you submit the form to / example / input.
I want to add the correct header code and explanatory text in PHP, for example. header('HTTP/1.1 404 Not Found');
1) Your entry contains errors. You stay on the page / example / input and again get the form marked with errors, etc. Which is HTTP 1.1. Would the code and text be correct to send with this redirect command?
2) Your input is OK, the item is saved, and you are redirected via Header('Location: ...') to / example / success. Which is HTTP 1.1. Will the code and text be correct here?
3). The PHP code throws an error due to incorrect configuration, missing include file, damaged database connection, or something else is wrong. Which is HTTP 1.1. Will the code and text be correct here?
I looked at the codes here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Number 200 is displayed on the right for 1), and number 301/302 is displayed on the right for 2), and 500 is for 3) . But in all three cases, I believe that the heading / explanation, following the codes on the link above, does not quite correspond to the scenario that I describe above. Should I choose other codes / text?
source share