i have an issue in validinting my form it's a singup form, i have login and user controller, whene i submit the form it takes me to login page.
Whene i change the default controoler to "user" it validates the form but whene i want to login it's not working. i want to know what is the probleme !
this is the validation form code from the user controller :
public function __construct()
{
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->library(array('session', 'form_validation', 'email'));
$this->load->database();
$this->load->model('user_model');
}
function index()
{
//set validation rules
$this->form_validation->set_rules('name', 'First Name', 'trim|required|alpha|min_length[3]|max_length[30]|xss_clean');
$this->form_validation->set_rules('prenom', 'Last Name', 'trim|required|alpha|min_length[3]|max_length[30]|xss_clean');
$this->form_validation->set_rules('email', 'Email ID', 'trim|required|valid_email|is_unique[teacher.email]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[cpassword]|md5');
$this->form_validation->set_rules('cpassword', 'Confirm Password', 'trim|required|md5');
//validate form input
if ($this->form_validation->run() == FALSE)
{
// fails
$this->load->view('backend/user_registration_view');
}
this is the view :
<div class="panel-body">
<?php $attributes = array("name" => "registrationform");
echo form_open("user/register", $attributes);?>
<div class="form-group">
<label for="name">First Name</label>
<input class="form-control" name="name" placeholder="Your First Name" type="text" value="<?php echo set_value('name'); ?>" />
<span class="text-danger"><?php echo form_error('fname'); ?></span>
</div>
this is the ink where i test my app please helpe me solve this issue:
http://prof.skolarie.com (login is the default controller).
I think whene login is set by default override the user controller !
Thanks
Update : The routes file;
$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
You can find the code source in this link below :