Welcome Guest, Not a member yet? Register   Sign In
CI3 die(var_dump($_POST)) is showing input value in the controller but
#1

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';
Reply


Messages In This Thread
CI3 die(var_dump($_POST)) is showing input value in the controller but - by P1207 - 05-01-2020, 07:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB