php - Login_validation() in CodeIgniter not working? -
my code:
<?php defined('basepath') or exit('no direct script access allowed'); class main extends ci_controller { public function index() { $this->login(); } public function login() { $this->load->view('login'); } public function members() { $this->load->view('members'); } public function login_validation() { $this->load->library('form_validation'); $this->form_validation->set_rules('email', 'email', 'required'); $this->form_validation->set_rules('password', 'password', 'required'); if ($this->form_validation->run() == true) { redirect('main/members'); } else { echo 'not working'; } } }
this login_validation function , login form in view:
<?php echo form_open('main/login_validation'); echo validation_errors(); echo "<p>email: "; echo form_input('email'); echo "</p>"; echo "<p>password: "; echo form_password('password'); echo "</p>"; echo "<p>"; echo form_submit('login_submit','login'); echo "</p>"; echo form_close(); ?> when enter email , password fields returns "not working".
also if don't enter email or password returns not working means library unable load guess. double checked documentation , seems right. ideas?
before saying thing want know , thing print or redirect desire uri? if not 1. @ first have know version of ci. if using ci 3.00 should check controller file name , class name (both should need start uppercase). 2.check .htaccess.
Comments
Post a Comment