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
Steven Weddle
6,625 PointsCode 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
Seif Eldein Sayed
3,508 PointsYou have extra space, or less space. check your spaces bro.
<?php echo $book ."SPACE(".$isbn")" ?>
Randy Hoyt
Treehouse Guest TeacherThere'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.
Joel Rivera
29,401 PointsHi 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.
Joel Rivera
29,401 PointsHi, I resolved it. Thanks
Ellen Zion
Courses Plus Student 8,853 PointsHow 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!
Steven Weddle
6,625 PointsThanks, Randy!
Francisco Argiro
2,312 Points/*
<?php foreach($books as $isbn => $book) { ?>
<li><?php echo $book ." (". $isbn. ")"; ?></li>
<?php } ?>
*/