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 trialDavid Locke
1,709 PointsCan't redirect : Warning: Cannot modify header information - headers already sent by (output started at /Applications
Hi there,
Re: Mikes Shirts Project When I try to pass a shirt without a valid id and without an id altogether, I am unable to redirect to shirts listing page.
This is the exact error message:
Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/treehouse/shirts4mike/includes/products.php:2) in /Applications/MAMP/htdocs/treehouse/shirts4mike/shirt.php on line 10
I have did a bit of research and see that one possible solution is that there should be no white spaces, however I don't have any spaces!
1 Answer
David Locke
1,709 PointsOk I have found solution which basically solves the problem. After my first <?php I have put ob_start(); and just before my closing ?> tag I've put ob_end_flush(); It works although I should really read up on why it works.