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

Header not being included

Hi,

I'm working on "Redirecting After a Form Submission" on the PHP course. I followed the video but my header doesn't seem to load.

The CSS stylesheet isn't applied to the page either so I'm assuming that somethings wrong with my include(header) code but I can't seem to find what the problem is. Here is my code.

<?php

$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

$pageTitle = "Contact Mike";
$section = "contact";
include("incude/header.php");

?>

    <div class="section page">

        <div class="wrapper">

            <h1>Contact</h1>

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

        </div>

    </div>

<?php include("include/footer.php"); ?>

The footer does show up on the page. Any suggestions?

3 Answers

Kevin Korte
Kevin Korte
28,109 Points

Yes, you didn't spell the word "include" correctly like you did in your footer tag. You are missing the 'L'.

Pro-tip: Spelling is the first thing I check when something doesn't work as planned. I would guess 75% of time it's the reason something is broken for me. I'm not a pro.

: D

OMG thank you so much.. I don't know why I couldn't spot that.

Kevin Korte
Kevin Korte
28,109 Points

You're welcome. It's easy for your own brain to gloss over simple mistakes like this. You know what it should have been, so your brain reads it as correct even when it's not by mostly reading the first and last letter of the word and filling in the middle....

I realize your question was rhetorical, but I couldn't resist.

Might be an obvious spot and sorry if it is but include is spelt wrong on your include header it says incude

Oppps kevin beat me to the spell check

haha thanks though!