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:

1
2
3
4
// 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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.