I have a problem with my change-password script. Can you please help me with this code? It should work, but it is not working. After clicking on the submit button, page just refreshes.
<?php
session_start();
require_once 'dbconnect.php';
if (isset($_POST['ulozitzmeny']) && ($_SESSION['user']) && strlen($_SESSION['user']) > 0) {
    $password = hash('sha512', mysql_real_escape_string($_POST['heslo']));
    $newpassword = hash('sha512', mysql_real_escape_string($_POST['noveheslo']));
    $passwordconf = hash('sha512', mysql_real_escape_string($_POST['potvrzenihesla']));
    $res = mysql_query("SELECT password FROM users WHERE username='$_SESSION[user]'");
    $row = mysql_fetch_array($res);
    if ($password != $row[0]) {
        echo" <div style='position:absolute;left:29.5%;top:10%;width:41%;' class='alert alert-danger fade in'>
             <a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
             <strong>Chyba!</strong> Nesprávné heslo!
             </div>";
    } else {
        if ($newpassword != $passwordconf) {
            echo" <div style='position:absolute;left:29.5%;top:10%;width:41%;' class='alert alert-danger fade in'>
             <a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
             <strong>Chyba!</strong> Hesla se neshodujĂ!
             </div>";
        } else {
            if (mysql_query("UPDATE users SET password='$newpassword' WHERE username = '$_SESSION[user]'")or die(mysql_query)) {
                echo" <div style='position:absolute;left:29.5%;top:10%;width:41%;' class='alert alert-success'>
             <a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
             <strong>Úspěch!</strong> Změny proběhly úspěšně!               
             </div>";
            }
        }
    }
}
?>
 
     
     
    