CodeIgniter Forums
Form Error on multiple submission - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Form Error on multiple submission (/thread-30128.html)



Form Error on multiple submission - El Forum - 05-04-2010

[eluser]Mark75[/eluser]
Hi all,
i'm running into an error and don't know how to fix it. i have a login function looking like this:

Code:
function login()
{
    $this->form_validation->set_rules('uid', 'uid', 'required|trim');
    $this->form_validation->set_rules('pwd', 'uid', 'required|trim|callback__check_user');
    if ( $this->form_validation->run() == FALSE )
    {
        $this->load->view('login');
    }
    else
    {
        $fields = array(
            'login_date' => date('Y-m-d H:i:s'),
            'login_ip' => $this->input->ip_address()
            );
        if ($this->admin_model->save($fields))
        {
            redirect('admin');
        }
        else
        {
            die('error');
        }
    }
}

This works fine until the loginform is submitted more than one time. In that case the error is displayed. I already have disabled the submit-button with javascript after it is submitted, but i also need something server-side. Could someone provide any hints about that?

Thank you!
Mark