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 Integrating Validation Errors Escaping Output

Enhancing a simple PHP application: Code Challenge doesn't make sense

Hi,

In this code challenge they say that we have to change the PHP, but it's already fine? I think I just don't get the question. Please explain!

The question: The PHP file below includes another PHP file that retrieves information from an external source for a directory listing. The page is supposed to display two input fields and a textarea, but it contains some malicious code. Modify the PHP code below to escape the output and display the correct HTML elements on the screen.

To go to the code challenge please click on the button at the right side of the page. Thanks in Advance!

3 Answers

Simon Sørensen
Simon Sørensen
17,304 Points

have you tried wrapping the variables in "htmlentites()"

No I haven't, thanks going to try it out. I'll inform you in a minute if I need anymore help.

Thanks, it worked!

Am I just stupid or is it: you're welcome?