السلام عليكم و رمضانكم كريم .

لدي مشكل في نظام استعادة كلمة المرور . هذا هو الكود

<?php

/* Password reset process, updates database with new user password */

include 'dbconfig/config.php';

// Make sure the form is being submitted with method="post"

if ($_SERVER["REQUEST_METHOD"] == "POST") {

// Make sure the two passwords match
if ( $_POST['rpassword'] == $_POST['crpassword'] ) {
  $nrpassword = md5($_POST['rpassword'],  PASSWORD_BCRYPT);

    // We get $_POST['email'] and $_POST['passr'] from the hidden input field of form
    $email = $connection->real_escape_string($_POST['email']);
    $passr = $connection->real_escape_string($_POST['passr']);

    $sql = "UPDATE users SET password='$nrpassword', passr='$passr' WHERE email='$email'";

    if ( $connection->query($sql) ) {
    header("location: pwrs.php");

    }

}
else {
    $_SESSION['message'] = "Two passwords you entered don't match, try again!";
}

}

?>

المشكل أنه لا يتحقق من تطابق الكلمتين .

يتم تحويلي الى صفحة "تم تغير كلمة المرور بنجاح" و عندما اتحقق منها اجدها لم تتغير .