07-01-2012, 01:09 PM
[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:
in the user_model:
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.
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.