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.

Hunter Hawley
3,948 PointsCheck if Form Was Sent in Same File
I am trying to learn how to display a thank you message after a contact form has been submitted on the same page. So if the form is on index.php, and once the form has been submitted it goes to index.php?form_submit=1, how can I make it so that on index.php?form_submit=1 it displays a thank you message by the contact form instead of what is there now, instructions.
1 Answer

Phillip Gibson
13,805 Points<?php if (isset($_GET["form_submit"]) AND $_GET["form_submit"] == 1) { ?>
<p>Thanks for contacting me!</p>
<?php } else { ?>
<form method="post">
<!-- contact form goes here -->
</form>
<?php } ?>
Hunter Hawley
3,948 PointsHunter Hawley
3,948 PointsThanks!
Phillip Gibson
13,805 PointsPhillip Gibson
13,805 PointsGlad to help!