Welcome Guest, Not a member yet? Register   Sign In
Problem with validation passing an array into POST
#1

[eluser]Isos[/eluser]
Hi all.

I am getting the following PHP error:

A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: libraries/Validation.php

Line Number: 195


in the top of my page which contains form with checkboxes having name="check[0][0]"
, name="check[0][1]", name="check[0][3]" ...

When I define rules, they are as following:
Code:
$rules['check'][0][0]= "required";
$rules['check'][0][1]= "required";
$rules['check'][0][2]= "required";

I am using an extended library of Validation (MY_Validation.php) suggested tonanbarbarian here: http://ellislab.com/forums/viewthread/48535/#327544
whether I would use native set_rules or the function set_rules_fields($rules,'check') of the extended library I still get this error! It's on the 195th line of Validation.php
Code:
$ex = explode('|', $rules);
inside funciton run()

Code:
function run()
    {
        // Do we even have any data to process?  Mm?
        if (count($_POST) == 0 OR count($this->_rules) == 0)
        {
            return FALSE;
        }
    
        // Load the language file containing error messages
        $this->CI->lang->load('validation');
                            
        // Cycle through the rules and test for errors
        foreach ($this->_rules as $field => $rules)
        {
            //Explode out the rules!
            $ex = explode('|', $rules);

            // Is the field required?  If not, if the field is blank  we'll move on to the next test
            if ( ! in_array('required', $ex, TRUE))
            {
                if ( ! isset($_POST[$field]) OR $_POST[$field] == '')
                {
                    continue;
                }
            }




Theme © iAndrew 2016 - Forum software by © MyBB