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 Simple PHP Application Adding a Contact Form Redirecting After a Form Submission

Jeremiah Swift
Jeremiah Swift
3,277 Points

PHP Redirect to Contact-thanks.php doesn't seem to be working.

header("Location: contact-thanks.php");

I am using mamp on mac. Any common mistakes to look for?

1 Answer

Jeremiah Swift
Jeremiah Swift
3,277 Points

Ok, so I was getting a blank page after the form submission and the problem is that on the contact-process.php file I was beginning the code on line 2. Apparently this can wreck a php page if it includes a redirect. (Was testing with Firefox)

1
2 <?php

Anyway, problem solved!