To complete John's answer, if you made a message on the form, you can put under your inputs:
<?php echo form_error('input-name'); ?>
But if you are making an ajax request (this is not your business now, but in the future, if you need to) you can use validation_errors ().
Here is an example:
//Important to turn that off if it on $this->output->enable_profiler(false); $this->output->set_status_header('500'); $this->output->set_content_type('application/json'); echo json_encode(array( 'error_msg' => validation_errors(), ));
And then on the client side you can use a response like this:
error:function(data) { $("your-error-input-selector").html('').append(data.responseJSON.msg); }
Hope I helped, even if I was one year late.
PS Sorry for my broken english.
source share