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 trialceasaraguilar
3,641 Pointsplease help, stuck.
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.)
Important: The code you write in each task should be added to the code written in the previous task.
Preview Check work
movie.php
<h1><?php echo $movie["title"]; ?> <?php echo ($movie["year"]); ?></h1>
<?php $movie = array();
$movie["title"] = "The Empire Strikes Back";
$movie["year"] = "1980";
?>
<h1><?php echo $movie["title"]; ?> <?php echo ($movie["year"]); ?></h1>
7 Answers
Florian Goussin
8,925 PointsI think you forgot the space between the name of the movie and the parenthesis for the date:
<?php $movie = array("title" => "The Empire Strikes Back",
"year" => "1980"); ?>
<h1><?php echo $movie["title"] ?> (<?php echo $movie["year"]?>)</h1>
Florian Goussin
8,925 PointsAt this step (3rd step ?) you'are not supposed to replace the year already, neither to have it in your array.
Aimee Ault
29,193 PointsHi Ceasar! Which step are you on of the challenge? I ask because the stuff you copy-pasted mentions leaving the year alone for now, but it looks like you might have replaced it a step too soon.
ceasaraguilar
3,641 PointsRight now, the <h1> element has the year of the original movie as a static piece of text. Replace that with a PHP command that INSTEAD displays the year of the new movie from the array. (Be sure to leave the parentheses intact.)
sorry i did put the wrong step i was having trouble in but its because it keeps saying to go back to that step because its not working.
it gives me this Oops! It looks like Task 3 is no longer passing.
and this is the code i have tried <?php $movie = array( $movie = "title" => "The Empire Strikes Back", $movie = "year" => "1980"
) ; ?>
<h1><?php echo $movie["title"];?> ( <?php echo $movie["year"];?> )</h1>
also <h1><?php echo $movie["title"];?> <?php echo ($movie["year"]);?> </h1> but failed also and tells me to go back to Task 3.
Florian Goussin
8,925 PointsIf you want to post code you should put it in between three ` .before and after it. Like that it is more visible for us.
Florian Goussin
8,925 PointsOh yeah. It is because you're not supposed to modify the previous code you submitted which has been validated. So for each new step you ought to add new code instead of modifying the previous one.
Otherwise your code syntax seems correct.
ceasaraguilar
3,641 PointsBut when I add code and not modify code that was already checked good I still cant get it. Can you help me on telling me how the code should look and which is right?
ceasaraguilar
3,641 PointsThanks Florian. I finally got it, really thanks. I been stuck there for 2 days or so.