CodeIgniter Forums
stupid input problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: stupid input problem (/showthread.php?tid=6569)

Pages: 1 2


stupid input problem - El Forum - 03-04-2008

[eluser]xwero[/eluser]
The changed post method

Code:
function post($index = NULL, $xss_clean = FALSE)
    {        
        if(is_null($index))
                {
                    if(count($_POST) == 0)
                    {
                        return FALSE;
                    }
                    else
                    {
                        if($xss_clean === TRUE)
                        {
                             foreach($_POST as $key => $val)
                             {
                                 $_POST[$key] = $this->xss_clean($val);
                             }
                        }
                        else
                        {
                            return $_POST;
                        }
                   }
                }
        
        if ( ! isset($_POST[$index]))
        {
            return FALSE;
        }

        if ($xss_clean === TRUE)
        {
            if (is_array($_POST[$index]))
            {
                foreach($_POST[$index] as $key => $val)
                {                    
                    $_POST[$index][$key] = $this->xss_clean($val);
                }
            }
            else
            {
                return $this->xss_clean($_POST[$index]);
            }
        }

        return $_POST[$index];
    }



stupid input problem - El Forum - 03-11-2008

[eluser]soupdragon[/eluser]
going back to this problem (was busy elsewhere)

I am now at the moment using

if(!empty($_POST)) {
# then check individual inputs
if($this->input->post('genre')) {

because if i dont i get errors...
Severity: Notice

Message: Undefined variable: input

I am sure this is wrong BUT help.... (at least _POST works)