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 Associative Arrays Task 7/7 (HTML ERROR)

Hi guys! I get error like : Bummer! The HTML for this page is not quite right

It had no errors until i inserted php code for imdb_ranking...

TASK: Right now, the three <td> elements have information about the first movie as static pieces of text. Replace each of those with PHP commands to display information about the second movie from the array. (Be sure to leave the <td> tags intact.)

MY CODE: <?php $movie = array( "title" => "The Empire Strikes Back", "year" => "1980", "director" => "Irvin Kershner", "imdb_rating" => "8.8", "imdb_ranking" => "11" ); ?>

<h1><?php echo $movie["title"];?> (<?php echo $movie["year"];?>)</h1>

<table> <tr> <th>Director</th> <td><?php echo $movie["director"];?></td> </tr> <tr> <th>IMDB Rating</th> <td><?php echo $movie["imdb_rating"];?></td> </tr> <tr> <th>IMDB Ranking</th> <td><?php echo $movie["imdb_ranking"];?></td> </tr> </table>

3 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Hmmm ... your code should pass. It looks like you have more white space than I expected, which is causing this code to fail. Sorry about that! I'll fix the code challenge shortly, but you can get it to pass by making the following change.

In lines 14, 15, and 16, you have this:

?>

<h1> ...

Change it so that it is all on one line:

?><h1> ...

Sorry about that!

Thanks guys :D I managed to pass. I have to admit that typos can be quite educating sometimes :D