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

Peter Garside
Peter Garside
7,233 Points

Unexpected Result

I have come to the end of this exercise and I seem to be missing something because I have been unable to produce the desired result. The contact form simply resets after submission instead of send forwarding to the thank you message.


(I am running this on a local mamp service and viewing through Chrome on a Mac OS X 10.9.2)

<?php if (isset ($_GET["status"]) AND $_GET["status"] == "thanks"); { ?>

                <p>Thanks for the email! I&#39;ll be in touch shortly.</p>

            <?php } else { ?>


                    <form method="post" action="contact.php">...</form>

I have also attempted (after advice from elsewhere) to change AND to &&, as below(but also to no avail);

<?php if (isset ($_GET["status"]) && $_GET["status"] == "thanks"); { ?>

I am a bit stumped and would greatly appreciate any pointers as where I am going wrong.

Many thanks,


2 Answers

Hi Peter,

You have a semi-colon at the end of your if conditional.

Post back here if there are still problems after fixing that.

Peter Garside
Peter Garside
7,233 Points

Thank you so much for the response Jason :)

Indeed I did, thanks for that, I've corrected this and double checked all of my code to make sure I haven't done this elsewhere also.

But unfortunately the same problem persists....

EDIT: I've now found the problem, slightly embarrassing :) Not related to the code snippet I posted at all. I had left the underscore out of $_SERVER, see below;


Should have been...


Anyway, thanks for the help Jason.