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 PHP Basics PHP on the Web Don't Repeat Yourself

David Dassau
David Dassau
8,628 Points

Name not showing up in the footer

I followed the video verbatim, and my name is showing up in the Title and Sidebar, but not in the footer for some reason. Here's my source code:

<?php
$display_name = 'David Dassau';
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset=utf-8>
    <title>PHP Basics by <?php echo $display_name; ?></title>
    <link href="css/style.css" rel="stylesheet" />
  </head>

  <body>
    <div id="wrap">
        <section class="sidebar text-center">
          <div class="avatar">
            <img src="img/logo.png" alt="Alt For Image">
          </div>
          <h1><?php echo $display_name; ?></h1>
          <p>Contact:<br />
          <a href="mailto:">EMAIL</a></p>
          <hr />
          <ul class="social">
            <li><a href=""><span class="icon twitter"></span></a></li>
          </ul>
          <hr />
          <p>Today: D, d M Y</p>
        </section>
        <section class="main">
          <h1>My First PHP Page</h1>

          <h2>Unit Conversion</h2>

          <hr />

          <h2>Daily Exercise</h2>
        </section>
    </div>
    <section class="footer text-center">
      &copy; 2016 <?php echo $display_name; ?>
    </section>
  </body>
</html>
David Dassau
David Dassau
8,628 Points

Nevermind, I got it to work!

2 Answers

Just adding an empty space after ... ?> in the footer did the trick for me.

How did you get it it work? I had the same issue.

Same issue here, anyone?

I just figured out, it's working when you add a p tag.

<p> &copy; 2016 <?php echo $display_name; ?></p>

displays properly my name in the footer section.