PHP Build a Basic PHP Website Adding a Basic Form Redirecting After a Form Submission

Aaron Uusitalo
Aaron Uusitalo
2,767 Points

Why don't the echo statements before the header method cause redirect failure?

We are warned not to send anything to the browser, even a blank line, lest it be interpreted as a header response and sabotage our redirect.

Why don't the echo statements at the start of our scrip cause this problem?

1 Answer

Andy Goodman
Andy Goodman
14,207 Points

I would like an answer to this question too.

The code clearly shows a number of echo statements in process.php above the header redirect, but the redirect works fine. One of the questions in the next section has an echo statement before the redirect and the correct answer is that you will see the echoed text, but with an error warning for the redirect.

Can someone explain this clearly please?