summaryrefslogtreecommitdiffstats
path: root/system/libraries/Validation.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Validation.php')
-rw-r--r--system/libraries/Validation.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index 7db67a3e1..ff5970837 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -65,18 +65,25 @@ class CI_Validation {
function set_fields($data = '', $field = '')
{
if ($data == '')
- return;
-
- if ( ! is_array($data))
{
- if ($field == '')
- return;
-
- $data = array($data => $field);
+ if (count($this->_fields) == 0)
+ {
+ return FALSE;
+ }
}
-
- $this->_fields = $data;
-
+ else
+ {
+ if ( ! is_array($data))
+ {
+ $data = array($data => $field);
+ }
+
+ if (count($data) > 0)
+ {
+ $this->_fields = $data;
+ }
+ }
+
foreach($this->_fields as $key => $val)
{
$this->$key = ( ! isset($_POST[$key]) OR is_array($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]);