CodeIgniter Laravel PHP Example Javascript jQuery MORE Videos New

How to change password in CodeIgniter framework

In this example we are going to show you How to send forgot password in CodeIgniter framework PHP.

Here we using 2 files for insert data in MySQL:

  • Forms.php Path: codeIgniter\application\controllers\Forms.php
  • forgot_pass.php Path: codeIgniter\application\views\change_pass.php

Forms.php (Controller)

class Forms extends CI_Controller 
	public function __construct()
		/*call CodeIgniter's default Constructor*/
		/*load database libray manually*/
		/*load Model*/
   public function forgot_pass()
			$que=$this->db->query("select pass,email from user_login where email='$email'");
			if((!strcmp($email, $user_email))){
				/*Mail Code*/
				$to = $user_email;
				$subject = "Password";
				$txt = "Your password is $pass .";
				$headers = "From:" . "\r\n" .


Invalid Email ID !

"; } } $this->load->view('forgot_pass',@$data); } } ?>

forgot_pass.php (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>Forgot Password</h2>
<form method="post" action=''>
		<label>Email ID :</label>
		<input type="password" name="email" id="name" placeholder="Email ID"/><br /><br />
	    <input type="submit" value="login" name="forgot_pass"/><br />

Run the program on your browser with URL:


Here codeIgniter is my folder name. Put your folder name instead of codeIgniter.Rest of things are same.