I have a list of array that im getting from $_POST. instead the traditional way to strip_tags $name = strip_tags($_POST[name]); $name = mysql_escape_string($name); $name = ucfirst($name); $prize = strip_tags($_POST[prize]); $prize = mysql_escape_string($prize); $deposit = strip_tags($_POST[deposit]); $deposit = mysql_escape_string($deposit); $bonus = strip_tags($_POST[bonus]); $bonus = mysql_escape_string($bonus); PHP: I have planned to use foreach to run a loop trough those submitted array. foreach ($_POST as $value) { $value = strip_tags($value); $value = mysql_escape_string($value); } extract($value); PHP: i doubt my foreach loop is done correctly but it should give you the idea of what im trying to archive.
if (isset($_POST) AND is_array($_POST)) { $_POST = array_map('strip_tags', $_POST); $_POST = array_map('mysql_real_escape_string', $_POST); extract($_POST); } PHP: This should do what you want.
It is also that you weren't operating on the elements in the array, just a new variable. You would need to replace the variable in the $_POST array for your array walk to work.