Welcome Guest, Not a member yet? Register   Sign In
default value paramater for get/post/cookie input class

I don't see any better outlet for this type of recommendation - I would love to contribute more to CI as my team and I have been using it recently on several projects.

Anyway, instead of sending a default value of false if a parameter is not set, I would recommend that it be a third option in the function.

For example:

function post($index = '', $xss_clean = FALSE, $default = FALSE)
        if ( ! isset($_POST[$index]))
            return $default;

Instead of returning false, I could assign a default value (which, by if not provided is false). I frequently need to assign something else, like a string or a non-zero integer.

I would recommend this for the get/post functions, if not the cookie/session functions as well.

Theme © iAndrew 2016 - Forum software by © MyBB