How to change Password in php

In this tutorial I will explain how user can change their old password.First Create a html form with three fields.

  • Old Password
  • New Password
  • Confirm Password

Now Validate these fields with javascript. After this create a php script for change password . PHP script given below :

HTML code for Change Password Form

Javascript Validation for change Password

Script for Change Password

Structure of userinfo Table

View Demo

Download Source code(How to change Password in php)
Size: 209 KB
Version: V 2.0

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Leave a Comment


  • “update userinfo set password=’ $newpassword’ where email=’$useremail'”);
    must be
    “update userinfo set password=’$newpassword’ where email=’$useremail'”);
    without the space before $newpassword

    The same with the database code:
    INSERT INTO userinfo (id, email, password, updation_date) VALUES
    (1, ‘’, ‘ Test@12345’, ‘2016-05-01 16:08:05’);
    must be
    INSERT INTO userinfo (id, email, password, updation_date) VALUES
    (1, ‘’, ‘Test@12345’, ‘2016-05-01 16:08:05’);