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.
Chase Lee29,275 Points
Redirecting After a Form Submission
I am doing "Redirecting After a Form Submission" in "Build a Simple PHP Application", and got to the part where Randy has us take the users to the "
contact-thanks.php". But it dosen't work for me.
Here is the code I have in
<?php $name = $_POST["name"]; $email = $_POST["email"]; $message = $_POST["message"]; $email_body = ""; $email_body = $email_body . "Name: " . $name . "\n"; $email_body = $email_body . "Email: " . $email . "\n"; $email_body = $email_body . "Message: " . $message; echo $email_body; //TODO: Send Email header("Location: contact-thanks.php"); ?>
<?php $page_title = "Contact Mike"; $section = "contact"; include("inc/header.php"); ?> <div class="section_page"> <div class="wrapper"> <h1>Contact</h1> <p>Thanks for the email. I’ll be in touch shortly.</p> </div> </div> <?php include("inc/footer.php"); ?>
And here is a link to my layout.
This question is for Randy,
If I'm placing my contact form in an iframe, or using an iframe, the function header () won't work, what do you suggest?