note 89234 added to function.addslashes
| From: | admin at circle14 dot net | Date: | Fri, 27 Feb 2009 11:39:36 +0000 |
| Subject: | note 89234 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151198@lists.php.net to get a copy of this message | ||
I like your add_slashes function to process $_POST arrays, only problem is that I needed to make a
few changes to actually get it to work for me. Here is the updated code:
<?php
function add_slashes ($an_array) {
foreach ($an_array as $key => $value) {
$an_array[$key] = addslashes($an_array[$key]);
}
return $an_array;
}
?>
and call it like this:
<?php $_POST = add_slashes($_POST); ?>
Thanks, your function saved me a few hours of coding! XD
----
Server IP: 208.69.120.35
Probable Submitter: 24.28.162.43
----
Manual Page -- http://www.php.net/manual/en/function.addslashes.php
Edit -- https://master.php.net/note/edit/89234
Del: integrated -- https://master.php.net/note/delete/89234/integrated
Del: useless -- https://master.php.net/note/delete/89234/useless
Del: bad code -- https://master.php.net/note/delete/89234/bad+code
Del: spam -- https://master.php.net/note/delete/89234/spam
Del: non-english -- https://master.php.net/note/delete/89234/non-english
Del: in docs -- https://master.php.net/note/delete/89234/in+docs
Del: other reasons-- https://master.php.net/note/delete/89234
Reject -- https://master.php.net/note/reject/89234
Search -- https://master.php.net/manage/user-notes.php