Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Basic PHP Website (2018) Adding a Basic Form Checking the Request Method

Andi Wilkinson
Andi Wilkinson
26,822 Points

the header redirect does not run

The course stated earlier that if anything was outputted before header() that the redirect would not work.

but in the example, there is text echoed before the header() function is executed. so for me locally, this does not work unless i remove everything above header();

I have followed along studiously, but at this point I downloaded the example to see if i had made an error, but the same thing happens.

Can I ask why the example shows code above the header(); function? and it works in the video example? struggling to understand what is happening