form_error()

form_error([$field = ''[, $prefix = ''[, $suffix = '']]])

Parameters:
  • $field (string) – Field name
  • $prefix (string) – Error opening tag
  • $suffix (string) – Error closing tag
Returns:

HTML-formatted form validation error message(s)

Return type:

string

Returns a validation error message from the Form Validation Library, associated with the specified field name. You can optionally specify opening and closing tag(s) to put around the error message.

Example:

// Assuming that the 'username' field value was incorrect:
echo form_error('myfield', '<div class="error">', '</div>');

// Would produce: <div class="error">Error message associated with the "username" field.</div>
doc_CodeIgniter
2016-10-15 16:32:19
Comments
Leave a Comment

Please login to continue.