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

5 Answers

Chris Southam
Chris Southam
1,823 Points

I've just run through that one briefly now and it should be: <h1><?php echo $movie['title'];?> (1985)</h1> with the date outside of the PHP.

Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

Thanks. As soon as I saw your work above, it all made sense. The HTML and PHP should remain separate, so (1985) should not have been included with the PHP nor did it need parenthesis because the browser was automatically interpreting it as HTML and not PHP.

You are AWESOME! Thanks again :)

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

Chris Southam
Chris Southam
1,823 Points

Carla Thomas Your version works just fine for me, displays the title and then (1985) within the H1. Not sure why you'd need it within the PHP tags though?
The other answer will echo out: $movie["title"](1985) since single quotes within an echo won't alter the PHP variables within.

Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

Hi Chris,

I am taking the PHP course here at teamtreehouse and the assignment is to wrap php within the html tags. This is the error message I get:

Bummer! It looks like the title of the second movie is in the &lt;h1&gt;, but something else isn't quite right. Double-check the parentheses and the year.
Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

Hi Chris,

I am taking the PHP course here at teamtreehouse and the assignment is to wrap php within the html tags. This is the error message I get:

Bummer! It looks like the title of the second movie is in the &lt;h1&gt;, but something else isn't quite right. Double-check the parentheses and the year.
Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

Thanks. As soon as I your work above, it all made sense. The HTML and PHP should remain separate, so (1985) should not have been included with the PHP nor did it need parenthesis because the browser was automatically interpreting it as HTML and not PHP.

You are AWESOME! Thanks again :)

Chris Southam
Chris Southam
1,823 Points

No worries - technically your code is correct but it's not the answer they were looking for.