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 Enhancing a Simple PHP Application Integrating Validation Errors Escaping Output

Cannot send an email...

Hi,

I have build an contact page with a form, but every time I try to complete the form in my localhost it is working, but when I put the site online, I get the following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/owesten/domains/odinwesten.nl/public_html/contact.php:1) in /home/owesten/domains/odinwesten.nl/public_html/contact.php on line 44.

I used exactly the same code as in the course "PHP build a simple application" and the tutorials of "Integrating Validation Errors".

2 Answers

I already found it, I accidentally removed one label, so I put that back, and now it is working

John MacDonald
John MacDonald
8,593 Points

Hey Suzanne,

I used to get this message alot when I went for free hosting companys like 000webhost or x10hosting if you are using another hosting company could you please specify.

Try including ob_start(); to the start of the file which is throwing the error.

Think of ob_start() as saying "Start remembering everything that would normally be outputted, but don't quite do anything with it yet.".

Hope this helps!

John /n/n