Welcome Guest, Not a member yet? Register   Sign In
Form and form validation - Can't get it to work
#1

[eluser]vYN[/eluser]
Hi. I'am new to codeingiter and php and so on. And i got a problem that i can't fix..

So. here is the code:
function:
Code:
function register()
{
        $this->load->helper('form');
        $this->load->library('form_validation');

        $this->form_validation->set_rules('REGusername', 'Username', 'required|min_length[3]|max_length[35]|trim|callback__check_username');
$this->form_validation->set_rules('REGpassword', 'Password', 'required|min_length[4]|max_length[35]');
        $this->form_validation->set_rules('REGemail', 'Email', 'required');
      
    if ($this->form_validation->run() === FALSE)
        {
    $data['site_title'] = 'Register';
       $data['content'] = 'user/register';
    $this->load->view('templates/default', $data);
       }
       else
        {
  $this->user_model->registeruser();
        $data['site_title'] = 'Done';
        $data['content'] = 'user/done';
        $this->load->view('templates/default', $data);
        }
}

in the user_model:
Code:
function registeruser($REGusername, $REGemail, $REGpassword)
    {
        $time = time();
        $sha1_password = sha1($REGpassword);
        
        $query_str = "INSERT INTO users (username, email, password, time_registered) VALUES (?, ?, ?, ?)";
        
        $this->db->query($query_str, array($username, $email, $sha1_password, $time));
        
    }

When i try to fail the registration. it does not give me any errors on the page...

and i have "<?php echo validation_errors(); ?>" on the page.

And i got an another form also. And it is the same with that. I'm not sure if it is some other code. Because the other one is supposed to send a mail. It simply does not work/do anything when i hit the submit button....

and here is my website registration: http://stiantofte.net/user/register


EDIT:

I think there is something wrong with my form_validation... Because it seems it can't pass it anyway. or give errors and so on.


Messages In This Thread
Form and form validation - Can't get it to work - by El Forum - 07-01-2012, 01:09 PM
Form and form validation - Can't get it to work - by El Forum - 07-01-2012, 05:00 PM
Form and form validation - Can't get it to work - by El Forum - 07-01-2012, 05:01 PM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 12:45 AM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 03:18 AM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 05:19 AM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 10:41 AM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 11:40 AM
Form and form validation - Can't get it to work - by El Forum - 07-03-2012, 04:21 PM
Form and form validation - Can't get it to work - by El Forum - 07-04-2012, 02:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB