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 Build a Simple PHP Application Listing Inventory Items Associative Arrays

Cant Solve this challenge

This is what i have to do:

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.)

And this is the code i have...

<?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>

keeps telling me to check the () and the Year but i havent make any changes to it, and even if i create a new element inside the array something like "year" => 1985 and try to echo it inside the () keep getting error.

9 Answers

First i would close the php statement with "?>". Maybe it helps.

well i jsut fast write it and not all of the code show but the point is that i do an Echo with the title of the movie and keeps asking to check the () and the year.

Press link Markdown Cheatsheet: so you will know how to show correctly the code, and i can try to help you.

<?php

  $movie = array(

    "title" => "The Empire Strikes Back"

  );

?>

<h1>Back to the Future (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>

thx for the tip with the "Markdown Cheatsheet"

Ok, should be simple. Post your solution, so i can check.

im on it.

Yes write me how you try to solve the challenge. Write here give your solution.

Out of no were it seems i did it right this time :| this is what i did and im 100% sure that i was doing it like that before...

<?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>

Ok it looks correct.

Check your first post, maybe is different the code you showed. Post it again (but with code visible ;) ) so we can compare.

i no longer have the original or first sorry :P, but still thanks a lot somehow i manage to do it right this time.

You wrote here in the forum in the first post, just was not so visible: for example i didn't see the closing php statement "?>".

But never mind, im happy you solved.