Need a Website Or Web Application Or Any Help In Code , Contact Us: +91 9437911966 (Whatsapp), Note: Paid Service
Students Tutorial app relased. Download Now.

How to change login password in PHP

$id = $_SESSION["id"];/* userid of the user */
$con = mysqli_connect('','root','','admin') or die('Unable To connect');
if(count($_POST)>0) {
$result = mysqli_query($con,"SELECT *from student WHERE name='" . $id . "'");
if($_POST["currentPassword"] == $row["password"] && $_POST["newPassword"] == $row["confirmPassword"] ) {
mysqli_query($con,"UPDATE student set password='" . $_POST["newPassword"] . "' WHERE name='" . $id . "'");
$message = "Password Changed Sucessfully";
} else{
$message = "Password is not correct"; } } ?>
<!DOCTYPE html>
<title>Password Change</title>

<h3 align="center">CHANGE PASSWORD</h3>
<div><?php if(isset($message)) { echo $message; } ?></div>
<form method="post" action="" align="center">
Current Password:<br>
<input type="password" name="currentPassword"><span id="currentPassword" class="required"></span>
New Password:<br>
<input type="password" name="newPassword"><span id="newPassword" class="required"></span>
Confirm Password:<br>
<input type="password" name="confirmPassword"><span id="confirmPassword" class="required"></span>
<input type="submit">