Welcome Guest, Not a member yet? Register   Sign In
Question about using set_value() outside of validation
#1

[eluser]DisturbedMind[/eluser]
Hi Group!

I am new to codeigniter, so i apologize if this question has been answered before. I tried doing a search, but was unable to find the answer.

I am writing an authentication library and can't figure out how to repopulate the form after a failed login attempt using the set_value() function. How do you repopulate the username field when you are echoing the set_value() function as the value from outside the validation process?

Here is an example of the view input
Code:
<input type="text" name="username" id="username" value="<?php echo set_value('username'); ?> />

Here is an example of the controller validation
Code:
if ($this->form_validation->run() == FALSE)
{
    // Validation has not run or there was an error
    $this->load->view('login');
    return;
}

$username = $this->input->post('username');
$password = $this->input->post('password');


if ($this->authentication->login($username, $password))
{
    redirect('success');
}
else
{
    redirect('login');
}




Theme © iAndrew 2016 - Forum software by © MyBB