[eluser]jrock2004[/eluser]
Ok so I thought I would kinda start this over. So with reading the form validation helper I came up with this
autoload
Code:
$autoload['libraries'] = array('database', 'session');
$autoload['helper'] = array('url', 'html', 'form');
view
Code:
<div id="login_form">
<h1>Login</h1>
<?php
echo form_open('admin/validate_credentials');
echo form_input('username', 'Username');
echo form_password('password', 'Password');
echo form_submit('submit', 'Login');
echo form_close();
echo validation_errors();
?>
</div><!-- end login_form-->
controller
Code:
function __construct() {
parent::__construct();
}
function index() {
$data['content'] = 'admin/login';
$this->load->view('admin/template.php', $data);
}
function validate_credentials() {
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if($this->form_validation->run() == FALSE) {
print_r($_POST);
$this->load->view('admin/login');
} else {
redirect('home', 'refresh');
}
}
With this code, when I hit submit it is reloading the login page. I do not see any errors. And POST is empty.