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 trialCarsten Dollerup
9,278 PointsWhy not just do htmlspecialchars($user_input) in the SERVER_METHOD brackets?
Why not just do htmlspecialchars($user_input) in the SERVER_METHOD brackets?
As in: if ($_SERVER["REQUEST_METHOD"] == "POST") { $message = htmlspecialchars(trim($_POST["message"])); }
I looked this up because I am deathly afraid of malicious code, and the thing is, that it'll seriously mess up a message with html signs. Most of you can probably figure this out by yourselves, whereas I had to look it up :-)
Example: A typed message with html characters like this in the message field: "I "really" don't like how your so called <green> shirt looks when I opened the box it came in! I am returning the order #1234232 immediately!"
Would "return" with the error message like this: "I "really" don't like how your so called <green> shirt looks when I opened the box it came in! I am returning the order #1234232 immediately!" And it would look like this in the e-mail generated as well unless you "roll it back" with another function before sending the mail.
I hope this is of use for someone.