If I used this
<?= validation_errors(); ?>
the result is
Username field is required
Password field is required
<textbox for username>
<textbox for password>
what I actually need is to display those errors inline with their element
example:
<textbox for username> Username field is required
<textbox for password> Password field is required
In order to display error individually you should use the function form_error(‘username’). And for you to get a value of a field being checked, use the function set_value(‘username’).
For these two functions to work, you would have had to, in your controller, set a rule for the ‘username’ field. Where you specify wich validation rules apply to that field.
Here is a simple tutorial about form Login