I'm using codeigniter form_validation, but it won't show any validation_errors message, this is my input tag named "name", I have already echo'd the validation_errors
<?= validation_errors(); ?>
<form action="" method="">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name">
</div>
this is my method to check if form_validation is correct
public function Add() {
$data['title'] = 'Add Student Form';
$this->form_validation->set_rules('name', 'Name', 'required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('templates/header', $data);
$this->load->view('student/add');
$this->load->view('templates/footer');
} else {
echo 'ok';
}
}
Why do I get no validation_errors message?
The problem is you didn't specify what kind of method you are going to use. is it POST or GET ?.
In your case use the method POST
<form action="" method="POST">
Hope that helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With