Welcome Guest, Not a member yet? Register   Sign In
input->post() with no parameters should return an array of ALL post data (and the same for get etc)
#1

[eluser]fritzthecat[/eluser]
Hi. Unless I am missing something, you can tell CI to give you all the post variables, you have to name the variable you want. It seems odd that I can use the input class to fetch a single variable, and the built in _POST array for cycling through all the vars.
Perhaps input->post() with no variables should return the whole, sanitized, array?

apologies if I'm missing something obvious, I'm pretty new to CI
#2

[eluser]xwero[/eluser]
You can get the array simply by using $_POST. The only reason why you would use the input post method is if you don't clean the globals globally but then you have to set the second parameter to TRUE so how are you going to signal you need the array instead of an item? Input class modification :
Code:
function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
{
    // start modification
    if(strlen($index) == 0)
    {
        if ($xss_clean === TRUE)
        {
            return $this->_clean_input_data($array);
        }

        return $array;
    }        
    // end modification
    if ( ! isset($array[$index]))
    {
        return FALSE;
    }

    if ($xss_clean === TRUE)
    {
        return $this->xss_clean($array[$index]);
    }

    return $array[$index];
}
Only usage that makes sense
Code:
$post = $this->input->post('',TRUE);
#3

[eluser]fritzthecat[/eluser]
$post = $this->input->post('',TRUE);
$post = $this->input->post( null,TRUE);

seems sensible to me




Theme © iAndrew 2016 - Forum software by © MyBB