Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to foreach $this->input->post(); in codeigniter?

I am writing a library for CI and I have a method I call to gather all possible post variables. I would somehow like to leverage the xss and security classes built into the codeigniter input class.

Is that possible?

Here is the working method without any use of the CI input class.


private function parse_options()
{  
    foreach($_POST as $key => $val)  
    {  
        $options[$key] = $val;  
    }  

    return $options;      
}
like image 318
Peter Avatar asked Dec 05 '22 23:12

Peter


1 Answers

Why not then:

private function parse_options()
{  
    foreach($_POST as $key => $val)  
    {  
        $options[$key] = $this->input->post($key);  
    }  

    return $options;      
}
like image 156
Jason Avatar answered Dec 10 '22 10:12

Jason