browser - Encoding $_GET[] values with PHP to make them broswer safe -


With PHP, which is the best way to use with $ _GET [] values ​​to secure the browser ?

I have read some HTML Specialties () and Helenties (). Should one of them be used or is there any other work that will work better?

Enough use HTML encoding is only necessary if you want to use those characters Which you can not be encoded with encoded characters.

But when you want to use, be sure to specify the quote_style parameter output in a attribute value cited with single quotation marks:

  Echo "input type = 'text' value = '". Htmlspecialchars ($ _GET ['foobar'], ENT_QUOTES) "'& Gt;";  

And to specify the charset parameter when you are using any character encoding except ISO 8859-1:

  Echo Htmlspecialchars ($ _GET ['foobar'], ENT_QUOTES, 'UTF-8');  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -