Escape $_POST with mysqli_real_escape_string
· One min read
If you want to apply mysqli_real_escape_string() to an entire $_POST array here is how you can do it
tip
assuming $conn is your mysqli connection
PHP
foreach ($_POST as $key=>$value) {
$_POST[$key] = mysqli_real_escape_string($conn, $_POST[$key]);
}