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

Code Challenge: Build a Simple PHP Application Integrating with PayPal Array Keys

For Task 2, I keep getting the error: "Bummer! I see all the book titles and the ISBNs in the browser, but the formatting is not quite right. Each list item should look like this: Book Title (978-0123456789)"

Here's what I have:

<ul>
        <?php foreach($books as $isbn => $book) { ?>
            <li> <?php echo $book ." (". $isbn. ") "; ?>  </li>
        <?php } ?>
</ul>

My output looks correct... what am I doing wrong?

4 Answers

You have extra space, or less space. check your spaces bro.

         <?php echo $book ."SPACE(".$isbn")" ?>
Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

There's supposed to be a space there, but I think the issue might be the space after the <li> tag. Try this:

<ul>
        <?php foreach($books as $isbn => $book) { ?>
            <li><?php echo $book ." (". $isbn. ") "; ?></li>
        <?php } ?>
</ul>

It's perfectly fine that you have a space there. I need to fix my test to ignore that: I wasn't expecting you to add a space there! Sorry for the trouble.

Hi Randy, I am getting the same issue. This is how I have it in the test. <ul> <?php foreach($books as $isbn => $book) { ?> <li><?php echo $book ." (". $isbn. ") "; ?></li> <?php } ?> </ul>

I am getting the same message as Steven Was.

Hi, I resolved it. Thanks

How did you resolve it? I am having the same problem, even though the screen shows spaces with my code:

<?php foreach($books as $isbn => $book) { ?> <li><?php echo $book ." (". $isbn. ") "; ?></li> <?php } ?>

I am getting this message:

Bummer! I see all the book titles and the ISBNs in the browser, but the formatting is not quite right. Each list item should look like this: Book Title (978-0123456789)

Thanks in advance!

Thanks, Randy!

/*

<?php foreach($books as $isbn => $book) { ?>

<li><?php echo $book ." (". $isbn. ")"; ?></li>

<?php } ?>

*/