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 trialFernando Gomez
18,527 PointsI'm not sure what I'm doing wrong....I'm stuck!
I'm in challenge 3 of 7 with the following instructions:
By the end of this code challenge, we'll REMOVE from the page all the information about the original movie ("Back to the Future") and REPLACE it with information about the new movie ("The Empire Strikes Back"). Right now, the <h1> element has the title of the original movie as a static piece of text. Replace that with a PHP command that INSTEAD displays the title of the new movie from the array. (Be sure to leave the <h1> tags, the parentheses, and the year intact.)
Here's my code:
<?php
$movie = array(
"title" => "The Empire Strikes Back"
);
?>
<h1><?php echo $movie["title"]; ?>(1985)</h1>
<table>
<tr>
<th>Director</th>
<td>Robert Zemeckis</td>
</tr>
<tr>
<th>IMDB Rating</th>
<td>8.5</td>
</tr>
<tr>
<th>IMDB Ranking</th>
<td>53</td>
</tr>
</table>
what am I missing??
Fernando
8 Answers
Jeff Busch
19,287 PointsHi Fernando,
Put a space between ?>(1985). Like this ?> (1985).
Jeff
Fernando Gomez
18,527 PointsLet me know if it works....
Richmond Lauman
28,793 PointsWorked both ways.
Carlos Ortega
3,092 PointsTry something like this
Concatination
<?php
$movie["title"] = "Star Wars";
echo "<h1 class=\"title\">" . $movie["title"] . "</h1>";
?>
Alex Cawley
9,291 PointsYour code looks great but i think you may be missing a silly space between the ending php tag and the year. I went back and did the challenge and this code passed fine!
<?php
$movie = array (
title => "The Empire Strikes Back"
);
?>
<h1><?php echo $movie['title']; ?> (1985)</h1>
Richmond Lauman
28,793 PointsSomeone else already figured it. :-)
Fernando Gomez
18,527 PointsThank you Alex, Richmond, and Jeff. That work! I was going crazy, and I can't believe for that little space it wasn't going thru....
Richmond Lauman
28,793 PointsI wonder if it would pass with
<h1><?php echo $movie["title"] . " "; ?>(1985)</h1>
It wouldn't be necessary because you can add the space outside of the PHP block, but I wonder if the quiz would accept it... I am gonna check.
Richmond Lauman
28,793 PointsYup. It passes when space is added outside the PHP or when added with concatenation.
Fernando Gomez
18,527 Pointsgood to know!!