Welcome Guest, Not a member yet? Register   Sign In
Form Action
#1

[eluser]AbyJaby[/eluser]
Hi everyone,

Can anyone tell me what should i do in case of form submission while submitting my login form if contains username or password incorrect renders an error and redirects to same login page again for eg; http://localhost/codeigniter/index.php/l...thenticate.

if again I click on submit the url will be http://localhost/codeigniter/index.php/l...thenticate

public function authenticate()
{
$this->load->model('Loginmodel');
$username = trim(stripslashes(strtolower($_POST['username'])));
$password = trim(stripslashes(strtolower($_POST['password'])));
$verify = $this->Loginmodel->getData($username, $password);
if($verify) echo '<h1 align="center">Login Successful!!</h1>';
else {
$this->session->set_userdata('error','Username Password Mismatch!!!');
redirect('login/index');

}
}

FOR VIEWS PAGE

&lt;form action="index.php/login/authenticate" method="post"&gt;

Please help me.
#2

[eluser]Chathuranga Tennakoon[/eluser]
it will be easy to give an answer if you can post your code segments here. then i can tell u what u have to do for achieving your requirement. anyway i will give you a short clue on achieving this. just load the login view if the login credentials are failed.
#3

[eluser]CroNiX[/eluser]
use a full url for your form action.
#4

[eluser]AbyJaby[/eluser]
Can u give me the example of full url in case of localhost.
#5

[eluser]louisl[/eluser]
Use CI's form and url helper to generate your form code. Makes life much easier.

Code:
echo form_open(site_url('login/authenticate'));

http://ellislab.com/codeigniter/user-gui...elper.html
http://ellislab.com/codeigniter/user-gui...elper.html
#6

[eluser]AbyJaby[/eluser]
Thanx dear




Theme © iAndrew 2016 - Forum software by © MyBB