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

Ileana Dell'Unti
Ileana Dell'Unti
2,282 Points

I can't find error, HELP!!!!

<?php

if ($_SERVER ["REQUEST_METHOD"]=="POST"){

$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 . "\n"; //TODO: send email

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

exit; }

?>

<?php $pageTitle = "Contact Mike"; $section = "contact";

include ('inc/header.php'); ?>

<div class ="section page">
    <div class="wrapper">
    <h1>contact</h1>

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

<p>Thanks for the email </p>

    <?php }  else{
?>
    <p> I want to hear from you!</p>

    <form method="post" action="contact.php"process.php>
        <table>
         <tr>
            <th>
                <label for="name">Name</label>
            </th>
            <td>
                <input type= "text" name="name" id="name">
            </td>
            </tr>
             <tr>
            <th>
                <label for="email">Email</label>
            </th>
            <td>
                <input type= "text" name="email" id="email">
            </td>
            </tr>
             <tr>
            <th>
                <label for="email">Email</label>
            </th>
            <td>
                <textarea name= "message" id="message"></textarea>
            </td>
            </tr>   

        </table>
        <input type="submit" value="send">
    </form>


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

3 Answers

only thing i see is a missing } bracket on the else section before you table.

        <input type="submit" value="send">
    </form>

<?php 
}
?>
    </div>

i am guessing it should go here

is php showing an error on the page?

Ileana Dell'Unti
Ileana Dell'Unti
2,282 Points

no just white page, and I an only use safari, :(