CI3 die(var_dump($_POST)) is showing input value in the controller but |
On submitting the values through the form, the controller is receiving the submitted values as checked by using 'die(var_dump($_POST));'
but otherwise control move to ($this->form_validation->run() == FALSE) and nothing happened. I have tried every possible option but I am unable to find any solution. Anything else needed? //my controller is Class User_authentication extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('login_db'); } public function index() { $this->load->view('login_form'); } public function user_login_process() { //die(var_dump($_POST)); //giving posted value //echo $this->input->post('emailid'); //giving nothing //echo $this->input->post('password'); //giving nothing $this->form_validation->set_rules('emailid','Email','required'); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[8]'); $pass=base64_encode($this->input->post('password')); if ($this->form_validation->run() == FALSE) { $this->load->view('login_form'); } else { $data = array( 'user_email' => $this->input->post('emailid'), 'user_password' => $pass ); $result = $this->login_db->login($data); $this->session->set_userdata('logged_in', $session_data); } } //my view login_form.php <div id="submain"> <h2>Login Form</h2> <hr> <?php if(isset($error_message)){?> <div class="error_msg"> <?php echo $error_message; ?> </div> <?php } echo form_open('user_authentication/user_login_process'); echo validation_errors(); ?> <label>Login Id :</label> <input type="email" name="emailid" id="emailid" placeholder="[email protected]"><br> <?php echo form_error('emailid', '<div class="error_msg">', '</div>'); ?> <br> <label>Password :</label> <input type="password" name="password" id="password" placeholder="****"><br> <?php echo form_error('password', '<div class="error_msg">', '</div>'); ?><br> <input type="submit" value="Login" name="submit" id="submit"><br> <?php echo form_close(); ?> <a href="user_registration_show" style="color:darkblue;font-size:20px;">To SignUp Click Here</a> </div> //config.php setup is $config['base_url'] ='http://localhost:85/Airline/'; $config['index_page'] = 'index.php';
@P1207,
It doesn't look like you loaded the form_validation library ( https://codeigniter.com/userguide3/tutor...ate-a-form ).
Hi!
I have loaded it in autoload.php $autoload['libraries'] = array('form_validation','database','session');
Yes
$autoload['helper'] = array('form','url','html','file','date','string','security'); (05-02-2020, 11:48 AM)php_rocs Wrote: @P1207,Yes it is giving bool(false) on var_dump($this->form_validation->run()); and my code is behaving very abnormally. Like when I am providing the value in the form which is stored in the database, the form get reloaded and comes to the end of the code. But.... when the values are not from db but in the proper format, it is doing all checking and providing invalid login id. I am attaching a file with code n screens with messages
Hi found the problem!
it is with session. when I commented the entire part for saving session data, program works fine. But now how could I handle the session? |
Welcome Guest, Not a member yet? Register Sign In |