note 112301 deleted from function.addslashes by aharvey
| From: | aharvey@php.net | Date: | Thu, 30 May 2013 17:52:43 +0000 |
| Subject: | note 112301 deleted from function.addslashes by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194999@lists.php.net to get a copy of this message | ||
Note Submitter: Elfo
----
an easy solution for addslashes all the $_POST, alsa if it contains array, or array of array
<?
function myaddslashes(&$post) {
if (!is_array($post))
$post=addslashes($post);
else
foreach ($post as $value)
myaddslashes($value);
unset ($value);
};
?>
//in the page
if ($_POST['submit'])
myaddslashes($_POST);
//rest of the code...