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 6856639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:54:42+00:00 2026-05-27T01:54:42+00:00

I have a dashboard with users details which they can edit. I would like

  • 0

I have a dashboard with users details which they can edit. I would like to add a password change but before they can change their password how would I validate their current password before letting them change to a new password?

So the form would have 3 fields. First field will have their current_password, follow by new_password and confirm_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-27T01:54:43+00:00Added an answer on May 27, 2026 at 1:54 am

    codeigniter comes with a Form Validation Class you can find the documentation here.
    Its purpose is exactly what its name suggest – It will help you validating your form input. Once you get used to it it comes in really handy.

    This is how your controller could look:

    public function change_password() {
       if ($this->input->post()) {
          // user submitted the form
          if (some_encryption_function($this->input->post('current_password'))==password_from_db) { // pseudo code
    
             $this->load->library('form_validation'); // this should probably belong somewhere else like in the constructor of the controller
             $this->form_validation->set_rules('new_password', 'New Password', 'trim|required|min_length[4]|max_length[12]|matches[confirm_password]');
             $this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|required|min_length[4]|max_length[12]');
    
             if ($this->form_validation->run() == false) {
                data['message'] = validation_errors();
             } else {
                store_new_password_to_db($this->input->post('new_password');
                data['message'] = "Some success message";
             }
             $this->load->view('your_change_password_view',$data);
          }
       }
    }
    

    This is not a perfect example for the form validation class. Just because you could easily validate those 3 fields without its help. But as its already built in with codeigniter why not use it?

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

Sidebar

Related Questions

i have created a dashboard to which all my users are being redirected to
I have created a class for a dashboard item which will hold information such
I know how to setup a route to a url like http://siteurl.com/mycustomaccount/dashboard , but
I have a model class called Dashboard and it has an attribute 'team_members.' Like
How can I programmatically add portlet to the JBoss Portal dashboard of specific user?
I have Users and Dashboards. They both have a HABTM relationship with each other.
I have a page on my DotNetNuke site and I would like to set
I have a web application that functions as a dashboard, allowing a user to
I have to develop a dashboard widget for Mac Osx to support 32/64 bit
Backgroup: We are looking at SAS BI Dashboard. We have currently implemented almost all

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.