EllisLab text mark
Advanced Search
     
default value paramater for get/post/cookie input class
Posted: 13 July 2007 07:59 PM   [ Ignore ]
Joined: 2007-07-13
1 posts

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.