Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!