Try this, it may or may not work....
It should run through all the values in the $_POST array and make a new array with sanitized values.
Code:
$sanitized_post = [];
$dbc = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
foreach($_POST as $key => $value)
{
$sanitized_post[$key] = $dbc->real_escape_string($value);
}