Codeigniter Tutorials
- What is codeigniter?
- Application_Architecture
- MVC Architecture
- HMVC Architecture
- Codeigniter Configuration
- Remove index.php from url in codeigniter
- MVC Concept
- View
- Alternate PHP Syntax for View Files
- Routing
- Codeigniter URL
- Get Current URL
- Previous page URL get
- Seo Friendly URL
- Slug Create in codeigniter
- What is _remap() function
- Remove controller name from url in codeigniter
- Codeigniter Controller Class
- Class Constructor
- GET $ POST method in Codeigniter
- Models
- Basepath, Apppath, FCPATH
- URI Segment
- Page Redirect
- Helper class
- Custom Helper class
- Form Helper
- Common Helper Functions
- Common Function
- Array Problems
- Call controller in Helper
- Add active class to menu using Helper class
- Custom Library
- Custom Library Example
- when to use get_instance()
- Codeigniter Hook
- how to work inline css in codeigniter
- Custom 404 page
- 404 custom error page
- Create custom config file in codeigniter
- How to set and get config item value
- How to Speed Up CodeIgniter App?
- Codeigniter Functions
- Session
- cookies
- How to Set & Get Tempdata in Codeigniter
- flash messages in Codeigniter
- Flashdata
- Encryption and Decryption In CodeIgniter
- Codeigniter security
- csrf token form security
- Password Hashing
- Form Validation
- Custom Validation
- Registration Form with validation
- Server Side Form Validation
- Validate Select Option Field
- Date Format Validation
- Date Format change in codeigniter
- Date Functions
- DOB Validation
- CI CRUD
- User SignUp
- User Login
- User Logout
- Login Account
- Login form with RememberMe
- Login Form with session
- User change password
- Change Password with Callback Validation to Check Old Password
- Forgot password
- Reset password
- Insert data in database
- Fetch data from database
- Update data in database
- Delete data in database
- File Upload
- Image Upload with resize Image
- Upload Multiple file and images
- Upload Multiple images with CRUD
- File and image update
- Upload Image Using Ajax.
- Email Send
- Email Send Using Email library
- Email Send Using SMTP Gmail
- Notification send
- store data in json format in DB
- Json parse
- Fetch data Using Ajax with Json data
- How to Show data Using Ajax with Json parse
- Get JSON Data from PHP Script using jQuery Ajax
- Insert data Using Ajax
- Submit data Using Ajax with form validation
- How to show data Using Ajax in codeigniter
- Insert & Update Using Ajax
- Registration Form With Validation Using Ajax in codeigniter
- Delete data Using Ajax Confirmation
- Delete All data Using checkbox selection
- Ajax CSRF Token
- Ajax Post
- Ajax serverside form validation
- Contact form using AJAX with form validation
- DataTable Using Ajax dynamically
- DataTables pagination using AJAX with Custom filter
- DataTables AJAX Pagination with Search and Sort in codeigniter
- DataTables in Codeigniter using Ajax
- Ajax Custom Serarch
- Ajax Live Data Search using Jquery PHP MySql
- Ajax Custom Serarch and sorting in datatable
- Dynamic Search Using Ajax
- Autocomplete using jquery ajax
- Jquery Ajax Autocomplete Search using Typeahead
- Dynamic Dependent Dropdown Using Ajax
- Dynamic Dependent Dropdown list Using Ajax
- Dynamic Dependent Dropdown in codeigniter using Ajax
- ajax username/email availability check using JQuery
- Check Email Availability Using Ajax
- Data Load on mouse scroll
- Ajax CI Pagination
- Pagination in codeigniter
- Ajax Codeigniter Pagination
- email exists or not using ajax with json
- CRUD using AJAX With Modal popup in CI
- Add / Show Data on modal popup using Ajax
- Modal popup Validation using Ajax
- Data show on Modal popup Using Ajax
- Add / Remove text field dynamically using jquery ajax
- How to Add/Delete Multiple HTML Rows using JavaScript
- Delete Multiple Rows using Checkbox
- Multiple Checkbox value
- Form submit using jquery Example
- REST & SOAP API
- Multi-Language implementation in CodeIgniter
- How to pass multiple array in view
- Captcha
- create zip file and download
- PhpOffice PhpSpreadsheet Library (Export data in excel sheet)
- data export in excel sheet
- Excel File generate in Codeigniter using PHPExcel
- Dompdf library
- tcpdf library
- Html table to Excel & docs download
- CI Database Query
- Database Query
- SQL Injection Prevention
- Auth Model
- Join Mysql
- Tree View in dropdown option list
- OTP Integration in codeigniter
- curl post
- download file using curl
- Sweet Alert
- Sweet alert Delete & Success
- Log Message in Codeigniter
- Menu & Submenu show dynamically
- Set Default value in input box
- Cron Jobs
- Stored Procedure
- Display Loading Image when AJAX call is in Progress
- Send SMS
- IP Address
- Codeigniter Tutorialspoint
- Website Link
- How To Create Dynamic Xml Sitemap In Codeigniter
- Paypal Payment Integration
- Get Latitude and Longitude From Address in Codeigniter Using google map API
- How To Create Simple Bar Chart In Codeigniter Using AmCharts?
- dynamic Highcharts in Codeigniter
- Barcode in Codeigniter
- Codeigniter Interview Questions
- Project
Home » Codeigniter »
Forgot Password in Codeigniter
Forgot password and password sent to your email Account
File Name : login.php
<p class='flashMsg flashSuccess' style="color:green;"> <?=$this->session->flashdata('pass_msg')?> </p>
<a href="<?php echo base_url()?>admin/login/user_forgot_password" class="forgot-btn">Forgot Password?</a>
Controller Function
File Name : Login.php controller
public function user_forgot_password()
{
$data = array();
$data['title'] = "Forgot Password";
$this->load->view('admin/forgot_password');
}
Forgot_password view
File Name : forgot_password.php
<?php if($this->session->flashdata('message')) {?>
<label><span style="color: #CC6633"><?php echo $this->session->flashdata('message');?><span></label>
<?php }?>
<form action="<?php echo base_url()?>admin/login/doforget" method="post" class="login-form">
<div class="form-group">
<label>Email</label>
<input type="email" name="emailid" id="emailid" placeholder="Enter Email" class="form-control" value="<?php echo set_value('emailid');?>">
<i class="fas fa-lock"></i>
<span class="help-block" style="color:red;"><?php echo form_error('emailid'); ?></span>
</div>
<div class="form-group">
<button type="submit" name="submit" class="login-btn">Submit</button>
</div>
</form>
Controller function
File Name : login/doforget.php
public function doforget()
{
$this->load->helper('url');
$email= $this->input->post('emailid');
$this->load->library('form_validation');
$this->form_validation->set_rules('emailid','emailid','required|trim');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('admin/forgot_password');
}
else
{
$this->db->select('*');
$this->db->from('admin_info');
$this->db->where('email',$email);
$qry = $this->db->get();
$result = $qry->result();
if(!empty($result))
{
$this->load->helper('string');
$userid = $result[0]->user_id;
$toemail = $result[0]->email;
$password= random_string('alnum',6);
$data = array('password'=> $password);
$this->db->where('user_id', $userid);
//$this->db->update('admin_info',array('password'=>$password,'pass_encryption'=>MD5($password)));
$this->db->update('admin_info',array('password'=>MD5($password)));
$config = Array(
'mailtype' => 'html',
'charset' => 'utf-8',
'priority' => '1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
//$this->email->set_mailtype("html");
$this->email->from('info@itechxpert.in', 'Forgot password');
$this->email->to($toemail);
$this->email->subject('Password Reset :');
//$this->email->message('You have requested the new password, Here is you new password: ' .$password);
$body = $this->load->view('admin/email_format.php',$data,TRUE);
$this->email->message($body);
if($this->email->send()){
$this->session->set_flashdata('pass_msg','Password has been reset and has been sent to your email');
redirect('admin/login');
}else{
$this->session->set_flashdata("password_error_msg","Sorry! Please Try Again.");
redirect('admin/login');
}
}
}
}
email format / Template
File Name : email_format.php
<html>
<head>
<style type='text/css'>
body {background-color: #CCD9F9;
font-family: Verdana, Geneva, sans-serif}
h3 {color:#4C628D}
p {font-weight:bold}
</style>
</head>
<body>
<h3>Password : <?php echo $password;?>,</h3>
<h3>Hi User,</h3>
<h4>You Can Change your Password After Login.</h4>
<p>Regards,</p>
<p>Itechxpert</p>
<p>Mob :- 7838897299</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>itechxpert - Forgat Password</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div>
<div style="font-size: 26px;font-weight: 700;letter-spacing: -0.02em;line-height: 32px;color: #41637e;font-family: sans-serif;text-align: center" align="center" id="emb-email-header">
<img style="border: 0;-ms-interpolation-mode: bicubic;display: block;Margin-left: auto;Margin-right: auto;max-width: 152px" src="https://itechxpert.in/sms/assets/admin/img/school.png" alt="" width="152" height="108"></div>
<p style="Margin-top: 0;color: #565656;font-family: Georgia,serif;font-size: 16px;line-height: 25px;Margin-bottom: 25px">Password : <?php echo $password;?>,</p>
<p style="Margin-top: 0;color: #565656;font-family: Georgia,serif;font-size: 16px;line-height: 25px;Margin-bottom: 25px">
You have requested the new password, Here is you new password.
</p>
</div>
</body>
</html>
<?php
class Forms extends CI_Controller
{
public function __construct()
{
//call CodeIgniter's default Constructor
parent::__construct();
//load database libray manually
$this->load->database();
$this->load->library('session');
//load Model
$this->load->helper('url');
$this->load->model('Hello_model');
}
public function forgot_pass()
{
if($this->input->post('forgot_pass'))
{
$email=$this->input->post('email');
$que=$this->db->query("select pass,email from user_login where email='$email'");
$row=$que->row();
$user_email=$row->email;
if((!strcmp($email, $user_email))){
$pass=$row->pass;
//Mail Code
$to = $user_email;
$subject = "Password";
$txt = "Your password is $pass .";
$headers = "From: password@example.com" . "\r\n" .
"CC: ifany@example.com";
mail($to,$subject,$txt,$headers);
}
else{
$data['error']="
Invalid Email ID !
";
}
}
$this->load->view('forgot_pass',@$data);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro|Open+Sans+Condensed:300|Raleway' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="main">
<div id="login">
<?php echo @$error; ?>
<h2>Forgot Password</h2>
<br>
<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 />
</form>
</div>
</div>
</body>
</html>
Forgot Password Example
view
File Name : forgotpassword.php
<a data-toggle="modal" href="#myModal"> Forgot Password?</a>
<!-- Modal -->
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog"
tabindex="-1" id="myModal" class="modal fade">
<div class="modal-dialog">
<form class="form-signin" role="form" action="<?php echo base_url('admin/Forgotpassword');?>" method="post" name="frm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title">Forgot Password ?</h4>
</div>
<div class="modal-body">
<p>Enter your e-mail address below to reset your password.</p>
<input type="text" name="email" placeholder="Email / User Name"
autocomplete="off" class="form-control placeholder-no-fix">
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default"
type="button">Cancel</button>
<button class="btn btn-success" type="submit" id="btn_forgot" name="btn_forgot" value="Submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
<!-- modal -->
Controller
File Name : Forgotpassword.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Forgotpassword extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('Auth_model');
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
}
public function index()
{
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('login');
}
else
{
$email= $this->input->post('email');
$this->load->helper('string');
$rs= random_string('alnum', 12);
$data = array(
'rs' => $rs
);
$this->db->where('email', $email);
$this->db->update('admin_info', $data);
//now we will send an email
$from = '<info@itechxpert.in>';
//$to = 'mahtab.alam@iwebbies.com';
$this->email->from($from, 'info');
$this->email->to($email);
$this->email->subject('Get your forgotten Password');
$this->email->message('Please go to this link to get your password.
http://itechxpert.com/Gmax_Admin/admin/Get_password/index/'.$rs );
$this->email->send();
echo " your password send on your email . Please check your email address.";
}
}
public function email_check($str)
{
$query = $this->db->get_where('admin_info', array('email' => $str), 1);
if ($query->num_rows()== 1)
{
return true;
}
else
{
$this->form_validation->set_message('email_check', 'This Email does not exist.');
return false;
}
}
}
Controller
File Name : Get_password.php
<?php
class Get_password extends CI_Controller
{
public function index($rs=FALSE)
{
$this->load->database();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[7]|max_length[20]|matches[passconf]|md5');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required');
if ($this->form_validation->run() == FALSE)
{
echo form_open();
$this->load->view('gp_form');
}
else
{
$query=$this->db->get_where('admin_info', array('rs' => $rs), 1);
if ($query->num_rows() == 0)
{
show_error('Sorry!!! Invalid Request!');
}
else
{
$data = array(
'password' => $this->input->post('password'),
'rs' => ''
);
$where=$this->db->where('rs', $rs);
$where->update('admin_info',$data);
echo "Congratulations!";
}
}
}
}
File Name : index.php
view
File Name : email_check.php
<?php echo validation_errors(); ?>
<?php echo form_open('gfp/index'); ?>
<h2> email</h2>
<input type="text" size="30" id="email" name="email"/>
<br/>
<input type="submit"name="submit" value="Submit"/>
</form>
controller
File Name : gfp.php
<?php
class Gfp extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
}
public function index()
{
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('email_check');
}
else
{
$email= $this->input->post('email');
$this->load->helper('string');6
$rs= random_string('alnum', 12);
$data = array(
'rs' => $rs
);
$this->db->where('email', $email);
$this->db->update('users', $data);
//now we will send an email
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'mahtab.habib@gmail.com';
$config['smtp_pass'] = 'mahtab****#';
$this->load->library('email', $config);
$this->email->from('mahtab.habib@gmail.com', 'mahtab.habib');
$this->email->to($email);
$this->email->subject('Get your forgotten Password');
$this->email->message('Please go to this link to get your password.
http://localhost/ci/get_password/index/'.$rs );
$this->email->send();
echo "Please check your email address.";
}
}
public function email_check($str)
{
$query = $this->db->get_where('users', array('email' => $str), 1);
if ($query->num_rows()== 1)
{
return true;
}
else
{
$this->form_validation->set_message('email_check', 'This Email does not exist.');
return false;
}
}
}
view
File Name : gp_form.php
<?php echo validation_errors();
echo "Password :".form_password('password', '');
echo "Password Confirmation :".form_password('passconf', '');
echo form_submit('submit', 'Submit');
?>
Controller :
file name : get_password.php
<?php
class Get_password extends CI_Controller
{
public function index($rs=FALSE)
{
$this->load->database();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[7]|max_length[20]|matches[passconf]|md5');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required');
if ($this->form_validation->run() == FALSE)
{
echo form_open();
$this->load->view('gp_form');
}
else
{
$query=$this->db->get_where('users', array('rs' => $rs), 1);
if ($query->num_rows() == 0)
{
show_error('Sorry!!! Invalid Request!');
}
else
{
$data = array(
'password' => $this->input->post('password'),
'rs' => ''
);
$where=$this->db->where('rs', $rs);
$where->update('users',$data);
echo "Congratulations!";
}
}
}
}
Forgot Password Example :-
File name : Password_forget.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Password_forget extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('Auth_model');
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
}
public function index()
{
$this->load->view('password_forget');
}
public function ForgotPassword()
{
$email = $this->input->post('email');
$findemail = $this->Auth_model->ForgotPassword($email);
if($findemail){
$this->Auth_model->sendpassword($findemail);
}else{
$this->session->set_flashdata('msg',' Email not found!');
redirect(base_url().'admin/Login','refresh');
}
}
}
View :-
File name : password_forget.php
<div>
<form id="resetPassword" name="resetPassword" method="post" action="<?php echo base_url();?>admin/password_forget/ForgotPassword" onsubmit ='return validate()'>
<table class="table table-bordered table-hover table-striped">
<tbody>
<tr>
<td>Enter Email: </td>
<td>
<input type="email" name="email" id="email" style="width:250px" required>
</td>
<td><input type = "submit" value="submit" class="button"></td>
</tr>
</tbody>
</table>
</form>
</div>
Model :-
File name : Auth_model.php
public function ForgotPassword($email)
{
$this->db->select('email');
$this->db->from('admin_info');
$this->db->where('email', $email);
$query=$this->db->get();
return $query->row_array();
}
public function sendpassword($data)
{
$email = $data['email'];
$query1=$this->db->query("SELECT * from admin_info where email = '".$email."' ");
$row=$query1->result_array();
if ($query1->num_rows()>0)
{
$passwordplain = "";
$passwordplain = rand(999999999,9999999999);
$newpass['password'] = md5($passwordplain);
$this->db->where('email', $email);
$this->db->update('admin_info', $newpass);
/*
$mail_message='Dear '.$row[0]['user_id'].','. "\r\n";
$mail_message.='Thanks for contacting regarding to forgot password,<br> Your <b>Password</b> is <b>'.$passwordplain.'</b>'."\r\n";
$mail_message.='<br>Please Update your password.';
$mail_message.='<br>Thanks & Regards';
$mail_message.='<br>Your company name';
date_default_timezone_set('Etc/UTC');
require FCPATH.'assets/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPSecure = "tls";
$mail->Debugoutput = 'html';
$mail->Host = "yooursmtp";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = "your@email.com";
$mail->Password = "password";
$mail->setFrom('admin@site', 'admin');
$mail->IsHTML(true);
$mail->addAddress($email);
$mail->Subject = 'OTP from company';
$mail->Body = $mail_message;
$mail->AltBody = $mail_message;
*/
$from = '<info@itechxpert.in>';
$this->email->from($from, 'info');
$this->email->to($email);
$this->email->subject('Get your forgotten Password');
$mail_message='Dear '.$row[0]['user_id'].','. "\r\n";
$mail_message.='Thanks for contacting regarding to forgot password.'."\r\n";
$mail_message.='Your Password is '.$passwordplain."\r\n";
$mail_message.'Please Update your password.';
$mail_message.='Thanks & Regards'."\r\n";
$mail_message.='itechxpert';
$this->email->message($mail_message);
if(!$this->email->send())
{
$this->session->set_flashdata('msg','Failed to send password, please try again!');
} else {
$this->session->set_flashdata('msg','Password sent to your email!');
}
redirect(base_url().'admin/Login','refresh');
}
else
{
$this->session->set_flashdata('msg','Email not found try again!');
redirect(base_url().'admin/Login','refresh');
}
}
Forgot Password View
File name : .php
<form class="form-signin" role="form" action="<?php echo base_url('admin/Forgotpassword');?>" method="post" name="frm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title">Forgot Password ?</h4>
</div>
<div class="modal-body">
<p>Enter your e-mail address below to reset your password.</p>
<input type="text" name="email" placeholder="Email / User Name"
autocomplete="off" class="form-control placeholder-no-fix">
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default"
type="button">Cancel</button>
<button class="btn btn-success" type="submit" id="btn_forgot" name="btn_forgot" value="Submit">Submit</button>
</div>
</div>
</form>
controller
File name : Forgotpassword.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Forgotpassword extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('Auth_model');
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
}
public function index()
{
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('login');
}
else
{
$email= $this->input->post('email');
$this->load->helper('string');
$rs= random_string('alnum', 12);
$data = array(
'rs' => $rs
);
$this->db->where('email', $email);
$this->db->update('admin_info', $data);
//now we will send an email
$from = '<info@itechxpert.in>';
//$to = 'mahtab.alam@iwebbies.com';
$this->email->from($from, 'info');
$this->email->to($email);
$this->email->subject('Get your forgotten Password');
$this->email->message('Please go to this link to change your password.
http://itechxpert.in/Gmax_Admin/admin/Get_password/index/'.$rs );
$this->email->send();
$this->session->set_flashdata('successpassmsg', '<div class="alert alert-success text-center">your password send on your email . Please check your email address.</div>');
redirect('admin/login');
}
}
public function email_check($str)
{
$query = $this->db->get_where('admin_info', array('email' => $str), 1);
if ($query->num_rows()== 1)
{
return true;
}
else
{
$this->form_validation->set_message('email_check', 'This Email does not exist.');
return false;
}
}
}
controller
File name : Get_password.php
<?php
class Get_password extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index($rs=FALSE)
{
$this->load->view('gp_form');
}
public function upd_password()
{
$this->load->database();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
//$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
$this->form_validation->set_rules('pass', 'Password', 'trim|required');
$this->form_validation->set_rules('confpass', 'Password Confirmation', 'trim|required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('admin/gp_form');
}
else
{
$rs = $this->input->post('rs_code');
$query=$this->db->get_where('admin_info', array('rs' => $rs), 1);
if ($query->num_rows() == 0)
{
show_error('Sorry!!! Invalid Request!');
}
else
{
$data = array(
'password' => $this->input->post('pass'),
'rs' => ''
);
$where=$this->db->where('rs', $rs);
$where->update('admin_info',$data);
$this->session->set_flashdata('thanksmsg', '<div class="alert alert-success text-center">Thankyou for changing password.</div>');
redirect('admin/login');
}
}
}
}
view
File name : gp_form.php
<form class="form-signin" role="form" action="<?php echo base_url()?>admin/Get_password/upd_password" method="post" name="frm">
<h2 class="form-signin-heading">Reset Password Now</h2>
<div style="font-color:red;"><?php //echo validation_errors(); ?></div>
<div class="login-wrap">
<input type="hidden" name="rs_code" value="<?php echo $this->uri->segment(4); ?>" readonly/>
<input type="password" class="form-control" name="pass" placeholder="Enter New Password" autofocus>
<input type="password" class="form-control" name="confpass" placeholder="Confirm Password">
<input class="btn btn-lg btn-login btn-block" type="submit" id="btn_login" name="btn_login" value="Submit"></button>
<div class="registration">
Go on sign page? <a class="" href="<?php echo base_url()?>admin/login">
signin </a>
</div>
</div>
</form>