Would this work:
//Add slashes to all the form fields
foreach ($_POST as $key=>$value)
{
$_POST[$key] = htmlspecialchars(addslashes(trim($value)));
}
//Variables that hold data to be inserted into database
$username = $_POST['username'];
$name1 = $_POST['first_name'];
$name2 = $_POST['last_name'];
$a1 = $_POST['address1'];
What I mean is if I do foreach() for the $POST variable to add slashes to the form input, and then I declare variables that hold $POST, would the variables hold the original value of $_POST or the value after the foreach()? Thank you for any help.