Most of the developers will look for forgot password functionality, now
I will show you to create forgot password form in 2 easy steps. For this we need to create below files.

1) Forgotpassword.php(view)
2) User.php(controller)

Programming Windows Store Apps with HTML, CSS, and JavaScript (Developer Reference)

Now create above two files in your projects to get functionality work.

<div class="container">
     	<div class="row padding-top-btm">
  			<div class="col-md-4">
            	<div class="new-car-con">

<form method="post" action="doforget" role="form" >
<div class="form-group">
<?php if($this->session->flashdata('message')) {?>
 <label><span style="color: #CC6633"><?php echo $this->session->flashdata('message');?><span></label>
<?php }?>

<h4>Forget pasword</h4>
<div class="form-group">
    <label for="txtLoginid">Email Id</label>
     <input name="emailid" type="email" size="25" id="emailid" placeholder="Enter email" class="form-control" value="<?php echo set_value('emailid');?>" />
     <span style="color:red"><?php echo form_error('emailid');?></span>
  <button type="submit" class="btn btn-default">Submit</button>

Now create controller file as below.
[sociallocker id=”3592″]


class User extends CI_Controller
public function __construct() {
public function display_doforget()
	public function doforget()
		$email= $this->input->post('emailid');
		 if ($this->form_validation->run() == FALSE)
		$q = $this->db->query("select * from user where emailid='" . $email . "'");
        if ($q->num_rows > 0) {
            $r = $q->result();
			$password= random_string('alnum',6);
			$this->db->where('user_id', $user->user_id);
			$this->email->from('[email protected]', 'sampletest');
			$this->email->subject('Password reset');
			$this->email->message('You have requested the new password, Here is you new password:'. $password);	
		    $this->session->set_flashdata('message','Password has been reset and has been sent to email');		

jQuery For Beginners: Your Guide To Easily Learn jQuery Programming in 7 days

Thanks for reading this article.