How to change password in CodeIgniter?

Today, We want to share with you change password in codeigniter.In this post we will show you how to send password reset link in codeigniter?, hear for check old password and updating a new password using codeigniter we will give you demo and example for implement.In this post, we will learn about forgot password in codeigniter with an example.

How to Make Forgot Password in Codeigniter?

Forms.php (Controller)

class Forms extends CI_Controller 
	public function __construct()
		/*call CodeIgniter's default Constructor*/
		/*load database libray manually*/
		/*load Model*/
	public function update_new_set_password()
			$que=$this->db->query("select * from client_sign_in where id='$session_id'");
			if((!strcmp($password_old, $pass))&& (!strcmp($freshpassword, $second_time_verify_password))){
				echo "Good Luck, Password changed successfully !";
					echo "sorry, Invalid";

CodeIgniter Model


class UserForm extends CI_Model 
	function getUserPassword($session_id)
	$getUserPassword=$this->db->query("select * from client_sign_in where id='$session_id'");
	function update_new_set_password($session_id,$freshpassword)
	$update_pass=$this->db->query("UPDATE client_sign_in set pass='$freshpassword'  where id='$session_id'");

CodeIgniter View


<!DOCTYPE html>
<title>Login Form -</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href='//|Open+Sans+Condensed:300|Raleway' rel='stylesheet' type='text/css'>

<div id="main">
<div id="login">
<?php echo @$error; ?>
<h2>Change Password</h2>
<form method="post" action=''>
		<label>Old Password :</label>
		<input type="password" name="password_old" id="name" placeholder="Eneter Your Old Pass"/><br /><br />
		<label>New Password :</label>
		<input type="password" name="freshpassword" id="password" placeholder="Eneter your New Password"/><br/><br />

		<label>Confirm Password :</label>
		<input type="password" name="second_time_verify_password" id="password" placeholder="Confirm Password"/><br/><br />
		<input type="submit" value="login" name="update_new_set_password"/><br />

Run the program on your browser with URL:

Also Read This πŸ‘‰   Vue.js Binding Fundamentals Using V-Bind Directive


I hope you get an idea about forgot password gmail in codeigniter.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Also Read This πŸ‘‰   PHP Whatsapp Rest API Send and Recieve WhatsApp Message