Click here to Skip to main content
16,017,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have provided validations for email and password, but even after typing the password, its says "Password is required", So I don't know where I am going wrong. The both email and password should get navigated to next page after typing. Eg : Login Created (Page should be displayed).Please anyone help me because I am new to PHP as well as Codeigniter.

What I have tried:

load->helper('form');
$this->load->helper('url');
$this->load->model('Login_db');
}

/**
* Login Page.
*/
public function index() {
$this->load->view('bootstrap/header');
$login_form_options = array();
// Validation.
$this->load->library('form_validation');
$this->form_validation->set_rules('email','Email','required|valid_email');
$this->form_validation->set_rules('password','Password','required');
//$this->form_validation->set_error_delimiters('
', '
');
if ($this->form_validation->run()== FALSE) {
$this->load->view('login_form', array(
'login_form_options' => $login_form_options,
));
} else {
$this->load->model('Login_db');
$login = new Login_db();
$login->email = $this->input->post('email');
$login->password = $this->input->post('password');
$login->save();
$this->load->view('login_form_success', array(
'login' => $login,
));
}
$this->load->view('bootstrap/footer');
}

}
Posted
Updated 23-Jul-19 22:05pm
v2
Comments
Richard MacCutchan 24-Jul-19 3:37am    
It looks like you are saving passwords in clear text. Good luck with recovering your system when the hackers login.
Member 10674091 24-Jul-19 3:38am    
No I am not. Its hidden
Member 10674091 24-Jul-19 3:40am    
And after typing the password, it still gives message as "Password is required".
Richard MacCutchan 24-Jul-19 3:49am    
I do not see any line of code that contains that message.
Richard MacCutchan 24-Jul-19 3:48am    
What do you mean "hidden"? Are you converting it to a hash before saving in the database?

1 solution

<?php echo validation_errors(); ?>

<form method="post">
    <div>
        <label for="issue_number">Email</label>
        <input type="text" name="email" value="">
    </div>
    <div>
        <label for="password">Password</label>
        <input type="password" name="Password" value="">
    </div>
    <div>
        <input name="remember" type="checkbox" value="Remember Me">Remember Me
    </div>
    <div>
        <input type="submit" value="LOGIN"/>
    </div>
</form>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900