Welcome Guest, Not a member yet? Register   Sign In
array in controller not recognized in rest of class' functions?
#3

[eluser]ScottBruin[/eluser]
Thank you for your response, Michael.

I'm now getting another error from the helper function that calls $this->rules.

Here's the function:

Code:
function userules_forinput($rules)
{
    // Pass an array of CI rules to this function and it will return
    // them formatted as [formname] => [value] in an array
    
    $CI =& get_instance();
    foreach($rules as $key => $value)
    {
        $item = $CI->input->post($key,TRUE); // takes $rules array and uses its keys to get the $_POST values; "true" runs these through xss_clean
        $item = trim($item);
        $input[$key] = $item;
    }
    return $input;  // *** ERROR for this line, variable undefined
}

I won't lie, I'm not quite sure what $Ci =& get_instance() does. I saw it on this forum and it fixed my problem, but my understanding of OOP is poor.


Messages In This Thread
array in controller not recognized in rest of class' functions? - by El Forum - 01-23-2008, 05:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB