Dave M G wrote:
PHP List,
I found this solution after a web search. I can't attribute the author, but would like to if I could.

I have a routine like this:

if (isset($_POST['choice'])) {
if (get_magic_quotes_gpc() ){
  stripslashes_arrays( $_POST );
}
$choice = $_POST['choice'];
}
else {
$choice = 'unknown';
}

and this is the function

# strips slashes to a multi dimensional array, by reference
function stripslashes_arrays(&$array) {
if ( is_array($array) ) {
  $keys = array_keys($array);
  foreach ( $keys as $key ) {
    if ( is_array($array[$key]) ) {
      stripslashes_arrays($array[$key]);
    }
    else {
      $array[$key] = stripslashes($array[$key]);
    }
  }
}
}



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to