how to set error message for each field in codeigniter php how to set error message for each field in codeigniter php codeigniter codeigniter

how to set error message for each field in codeigniter php


I solved it ...first of all autoload form helper and thern in view file

 <?php if (form_error('gender')) {    echo "कृपया लिंग निवडा"; }  ;?>

where 'gender' is my field name.And I do it for each field in my form.


Hi you have to the following thing if you use

<?php echo validation_errors();?> 

this will print all error in one place if you want to print each field with its own error then use this

<? echo form_input('field_name').br().form_error('field_name') ?>

if you are using multi language site then put your all error message in language files

please read form validation doc for complete understanding

http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#errordelimiters