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

[SOLVED]My header is displaying information that's supposed to be sent in the email, on the thank you page.

I am not sure what I've done wrong. When I fill out the form fields and click send, it takes me to the thank you page. Looks like everything is displaying correctly, other than the fact that everything I typed in the form is displaying above my header.

For example, I typed in Randy, randy@treehouse.com and my message. It displays (something like below):

Randyrandy@treehouse.commymessage.

Also, Randy used the <pre> tags in the previous video. This time, they seem to have disappeared. Am I missing something?

I've gone over this multiple times and can't find the error.

[EDIT]: I've found the problem. Randy removed the <pre> tags and the echo function from the code. My question about the pre tags: what exactly is its function?

(Even though I've found the problem, I'll leave it here so that anyone else who doesn't notice this in the video can see the solution.)

1 Answer

It was already answered here: https://teamtreehouse.com/forum/redirecting-after-form-submission-doesnt-work-for-me-even-tho-i-copied-code-on-the-video-worked-before-last-stage

What I did: Add the header line right after the php open tag and it works.

Thank you, and yes, I've already found the solution as I mentioned in the Edit section of my question.