I'm trying to implement that users can change password once they are logged into the dashboard of my system.
When I attempt to change password, nothing happens though there are no errors and I'm not sure what I'm doing wrong. I have implemented password hash to keep users password safe though I'm not sure that may be the issue.
Here is my change password code
<?php
include('../configfiles/config.php');
session_start();
if (isset($_POST['submit']))
{
  $logged_in_user = $_SESSION['loggedin'];
  $currentpassword = $_POST ['currentpassword'];
  $newpassword = $_POST ['newpassword'];
  $newhashpassword = password_hash($newpassword, PASSWORD_DEFAULT);
  if ($newpassword != $currentpassword)
  {
    $sql = ("SELECT * FROM users WHERE email = '$logged_in_user'");
    $db_check = $db->query($sql);
    if (password_verify($currentpassword, $db_check->fetch_assoc()['password']))
    {
      $fetch = $db->query("UPDATE users SET password = '$newhashpassword' WHERE email = '$logged_in_user'");
      $currentpassword = ''; 
      $newpassword = '';
      header('Location: ../dashboard.php');
    }
  }
}
?> 
 
    