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.


(Solve) Build A Simple PHP Application Learning > Step 3 > Adding a Contact Form

Hi, there. I`m in learning this topic. But after I complete all the coding as Randy Hoyt provide & fill in the form. I do not get the result to contact.php?status=thanks page. It keep stuck at contact.php page with nothing change.

I just do not know what`s going on. Hope some one can provide a help, thank you.

Below is my code:


    $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;

    // Todo: Send email

    header("Location: contact.php?status=thanks");

$section = "contact";
$pagetitle = "Contact Mike";

    <div class="section page">

        <div class="wrapper">


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

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

            <?php } else { ?>

                <p>I&rsquo;d love to hear from you! Complete the form to send me an email.</p>

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

                                <label for="name">Name</label>
                                <input type="text" name="name" id="name">
                                <label for="email">Email</label>
                                <input type="text" name="email" id="email">
                                <label for="message">Message</label>
                                <textarea name="message" id="message"></textarea>
                        <input type="submit" value="Send">

            <?php } ?>



<?php include('inc/footer.php'); ?>

2 Answers

I just found that I wrong wrote the REQUEST_METHOD become REQEUST_METHOD. May I ask how to delete or close this topic? Thank you.

Chase Lee
Chase Lee
29,275 Points

Just mark your answer as "best answer". There will be a green check mark next to your post on the forum showing that it was resolved.

Thanks for your help, James. :)