Can you give helpers a variable and change the function it uses in CodeIgniter
03:58 28 May 2015

I am creating a form and I want to make a custom error log, for example when the user leaves e-mail empty, I want to give my error_helper the variable email, sending to the user that they did not fill in this variable and log that they left this empty. I am a starter with codeIgniter and I've read the manual but I did not find anything helpful. Here is my code:

    public function submitCheck() {
    $this->load->model("User");
    if(empty($post['email'] || 'email'==""))
    {
        echo "Email is empty."; //This will be changed to a view for user    
        $this->load->helper('error'); //Loading the helper
        errorLog('Firstname'); //Variable I want to give to the errorLog function.
        exit();
    }    

So here I've given my errorLog a variable, which I want to use in my error_helper

    function errorLog(){         
     if(errorLog() == 'email') //Here I want to change the error function based on what variable I give to errorLog
     {
        log_message('error', 'Email was empty');
        exit();
     }
}  

Is this possible to do or some other way how I can change the function based on what variable I give my errorLog. Thanks in advance

php codeigniter