Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6008827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:52:57+00:00 2026-05-23T01:52:57+00:00

Can I display a single message for the multiple form fields in CodeIgniter? For

  • 0

Can I display a single message for the multiple form fields in CodeIgniter?
For example, I have set following rules for the email and password fields. I want to display only one message if any of these two fields is invalid. (eg. invalid email or password “)

$this->form_validation->set_rules('email_address', 'Email Address', 'valid_email|required');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[4]');

How i can do that? Thanks for any help.

Edit: Sorry if my question is not clear. Currently I’m using validation_errors(), and i get errors of each field. However, I want to show a same error message if any of the two fields (email or password) is invalid. No matter if email is invalid, or if password is invalid, or both are invalid, it should print a single message, such as: invalid email or password.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:52:58+00:00Added an answer on May 23, 2026 at 1:52 am

    I’m not sure if this is what you need, but you can try:

    if($this->form_validation->run() == FALSE){
       $message = 'Your error message here'; //validation_errors() works too.
    }else{
       $message = 'Your success message here';
    }
    
    $this->load->view('yourview',array('feedback_message'=>$message));
    

    If you don’t care which field isn’t valid, then this snippet is ok. “Something is wrong, i don’t care what’s wrong, tell the user”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I display multiple lines within a single cell of a JList. In
Can anyone tell me how I can display a status message like 12 seconds
I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display
I can't display the first entry from my query that returns multiple answers. For
If you have a statically allocated array, the Visual Studio debugger can easily display
What I would like to do is to display a single form that lets
I need to programatically set EditText to display text like password and I also
With LINQ to SQL in a ASP.NET MVC website I can display objects (records)
I'm using System.Drawing.Color, is there anything in Visual Studio that can display the color
How can I display a sort arrow in the header of the sorted column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.