Aaron Uusitalo2,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?
Andy Goodman14,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?
Steven Jackson4,174 Points
They definitely said that even a blank line will cause the re-direct to fail. This looks like an issue with workspaces. I've been using VSCode on this project and the echo statements caused an error. After all an echo creates more than a blank line. Once removed the redirect works properly in the VSCode environment. When I tested it in workspaces the redirect happens regardless of whether or not there is an echo statement. Has to be a bug with workspaces. Even though workspace is pretty amazing for an in-browser app it still has a few bugs. Take the time to set up a dev environment in VSCode or another appropriate IDE. You'll definitely thank yourself later.
Hope this helps!