Hello, I have an array.

Array ( [userregistration] => Array ( [email] => ddd [password1] => rr [password2] => rrr ) ) 

How to clear it so that it is without html tags of JS codes and so on. I used to clean every variable like this

 $test= htmlentities(mysqli_real_escape_string($db, $test),ENT_QUOTES, 'UTF-8'); 

How can this be changed to an array so that later the data from the array can be entered into the database without fear?

    1 answer 1

    Did so.

     $userregistration = $_POST["userregistration"]; foreach ($userregistration as $key => $value) { $userregistration[$key] = trim(htmlentities(mysqli_real_escape_string($db, $value),ENT_QUOTES, 'UTF-8')); }