Skip to main content

One post tagged with "php"

View All Tags

Escape $_POST with mysqli_real_escape_string

· One min read
Dimitar Dzhongov
Web Security Expert & Developer

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]);
}