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 Working with Get Variables

Is there a problem if I don't add the header("Location: contact.php")? And just display the thank you message with a...

I didn't add the ("Location: contact.php") and used the variable instead with the "REQUEST_METHOD" variable to display the thank you message, down the page. I displayed the information with echo "<p>$emailbody<p>"; to see if it works, and it's perfectly fine, but I just wonder if there's any problem with this method.

1 Answer

If it works how you want it - it's never really a problem!

By not redirecting after a form submission, you might get some interesting bugs if the user refreshes - does the form send again? - and if the user presses the back button.

Thanks a lot! It cleans the form, but it has problems when it relies or getting back, as you said. Thanks a lot! I think it can be solved with a variable at the web direction.