I create a login controller and loaded all necessary library and helper when I try to validate my login form it shows fatal error undefined validation_errors()
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class LoginController extends CI_Controller{
public function index()
{
$error['error']='';
$this->load->library('form_validation');
$this->load->helper(array('form','url'));
$this->form_validation->set_rules('user','Username','required|trim');
$this->form_validation->set_rules('password','Password','required|trim');
if($this->form_validation->run())
{
echo 'success';
}
else
{
$error['error']='username required';
return redirect('welcome/login','refresh',$error);
}
}
}
this is my view
<div class="container">
<?php echo validation_errors()?>
<div id="loginbox" class="mainbox col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3">
<div class="row">
<div class="iconmelon">
<svg viewBox="0 0 32 32">
<g filter="">
<use xlink:href="#git"></use>
</g>
</svg>
</div>
</div>
<div class="panel panel-default" >
<div class="panel-heading">
<div class="panel-title text-center">Bootsnipp.com<?php echo $error;?> </div>
</div>