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
Simon Latham
Courses Plus Student 6,261 PointsCode Challenge: Escaping Out
I keep getting this error message when I use htmlspecialchar():
PHP Fatal error: Call to undefined function htmlspecialchar() in views_listing_edit.php on line 13
Line 13 refers to:
input id="name" name="name" value="<?php echo htmlspecialchar($listing_name); ?>"
What am I doing wrong? I can't seem to figure it out, which means I can't move on to the rest of the course.
HELP!
Joakim Andersson
Courses Plus Student 2,714 Points<?php $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; // <a href='test'>Test</a> ?>
3 Answers
Randy Hoyt
Treehouse Guest TeacherYeah, it looks like you are missing an s at the end of the function name. Instead of this ...
htmlspecialchar(
... it should be ...
htmlspecialchars(
Did that solve the problem?
Simon Latham
Courses Plus Student 6,261 PointsDoh! Of course.
Thanks, Randy and Joakim.
Simon Latham
Courses Plus Student 6,261 PointsBy the way, Randy... any plans for a PHP Deep Dive in the near future?
Randy Hoyt
Treehouse Guest TeacherI'm working on a PHP & MySQL course right now, moving all the products for the Shirts 4 Mike site from our products array to a database. A PHP Foundations / Deep Dive course would probably make sense after that, but we don't have our PHP content planned that far out yet.
Simon Latham
Courses Plus Student 6,261 PointsCool... I look forward to that.
I'm having a little trouble in getting my head around the rewrite url section... the rest I followed quite well, to the point where I want to learn more (which is why I thought of a Deep Dive).
So I think I'll mosey on back to the beginning of Enhancing a Simple PHP Application... and go a little slower, this time.
Keep up the good work.
Simon
Randy Hoyt
Treehouse Guest TeacherThanks! Rewrite Rules can definitely be tricky. They work at a different level of the web stack: they work at the web server level, giving Apache instructions for what PHP code to execute in order to respond to web requests. I would recommend going back through that badge again. :-)
Alex Heil
53,547 Pointsgreat news Randy Hoyt ,
I really enjoyed watching your videos - great job! - and looking forward to what's coming next - also agree with Simon Latham that a deep dive would be a very nice addition and pretty useful ;)
Joakim Andersson
Courses Plus Student 2,714 PointsJoakim Andersson
Courses Plus Student 2,714 Points<b>htmlspecialchars();</b> ?