With PHP, which function is best to be used with $_GET[] values to make them browser safe?
I have read up on a few htmlspecialchars() and htmlentities(). Should one of those be used or is there another function that would work better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using
htmlspecialcharssuffices to encode the HTML special characters.htmlentitiesis only necessary if you want to use characters that can not be encoded with the character encoding you are using.But make sure to specify the quote_style parameter when you want to use the output in an attribute value quoted with single quotes like:
And to specify the charset parameter when you’re using a character encoding other than ISO 8859-1: