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

Error on line that there is no code.

Hello,

I am getting a error where I have no code. Here is my code: <?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.php?status=thanks");
exit;

?> <?php $pageTitle = "Contact mike"; ?> <?php $section = "contact"; ?> <?php include('includes/header.php'); ?>

<div class="section page"></div> <div class="wrapper"></div> <h1>Contact</h1> <?php if (isset($_GET["status"]) AND $_GET ["status"] == "thanks") { ?> <p>Thanks for the email! I’ll be in touch shortly. </p> <?php } else { ?>

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

          <form method="post" action="contact.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="message">message</label>
          </th>
          <td>
          <textarea name="message" id="message"></textarea

          </td>
          </tr>



          </table>
          <input type="submit" value="Send" />


           </form>

                </div> 

            </div>

Here is my error message. Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\shirts4mike\contact.php on line 75

I don't have anything on line 75 I have looked and looked for a error above that and I can not see it. I am hoping that fresh eyes will be able to find it.

Thanks, Shannon

2 Answers

missgeekbunny
missgeekbunny
37,033 Points

Um if you have exactly what you posted in your code it's because you don't seem to have the } to close your else statement. That could give you the error if you are missing it.

Richard Duncan
Richard Duncan
5,568 Points

From what I can tell you haven't closed your 'Contact' conditional if-else statement, try adding: -

<?php } ?> at the end of your html.