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 Enhancing a Simple PHP Application Adding Search: Controller & View Accounting for Empty Results

Aminu Tijani
Aminu Tijani
7,944 Points

Keeps saying I am wrong

I have written the right code but keeps telling it'snot right.

Please assist.

index.php
<?php

    $recommendations = array();

?><html>
<body>

    <h1>Flavor Recommendations</h1>

  <?php if(!empty($recommendation)){  
        echo '<ul>';
            foreach($recommendations as $flavor) {
                echo '<li>$flavor</li>';
            }
        echo '</ul>';
        }  else {
        echo '<p>There are no flavor recommendations for you</p>';
    }

  ?>

</body>
</html>

1 Answer

Mike Costa
PLUS
Mike Costa
Courses Plus Student 26,362 Points

I just tested this out and your code looks correct, however, it looks like the code interpreter is a stickler for exactly what it's asking. In the quiz question, it asks you to add a paragraph tag, and inside of that add exactly what is inside the quotes (the period included) and it should pass.

Aminu Tijani
Aminu Tijani
7,944 Points

It works. I omitted the period at the end of the text.

Thanks a lot