note 39259 added to function.stripslashes

From: Date: Thu, 22 Jan 2004 09:43:40 +0000
Subject: note 39259 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-64003@lists.php.net to get a copy of this message
stripslashes() will kill your php associative form field[] names. Here is a method from my general application object that solved the problem: function Input($f_name) { $f_data = $_REQUEST[$f_name]; if ($f_data) { if (get_magic_quotes_gpc()) { if (is_array($f_data)) { foreach ($f_data as $key => $value) { $array[$key] = stripslashes($value); } return $array; } else { return stripslashes($f_data); } } else { return $f_data; } } else { return ""; } } Note: I run this on all my php apps for consistency only. I have other functions that handle escaping when necessary. ---- Manual Page -- http://www.php.net/manual/en/function.stripslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39259 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39259&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39259&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64003) next »