In my PHP application, I have lots of places where I get POST data and have to convert it to htmlspecialchars, so I find myself having to specify and convert each element in $_POST individually. Here's an example:
$tusername=htmlspecialchars($_POST['username'], ENT_QUOTES,'UTF-8');
$tfname=htmlspecialchars($_POST['firstname'], ENT_QUOTES,'UTF-8');
$tlname=htmlspecialchars($_POST['lastname'], ENT_QUOTES,'UTF-8');
$temail=htmlspecialchars($_POST['email'], ENT_QUOTES,'UTF-8');
$tskill=htmlspecialchars($_POST['skillsearchpriv'], ENT_QUOTES,'UTF-8');
This can get tedious, especially when you have over +10 $_POST variables for multiple forms.
Is there away of converting all POST variables to htmlspecialchars at once?
Something like $_POST=htmlspecialchars($_POST[allkeys], ENT_QUOTES,'UTF-8');
?