<?php 
$select = mysqli_query($conn, "SELECT * FROM `users` WHERE `id` = '".$_SESSION['login_id']."'");
$rows   = mysqli_fetch_assoc($select);

?>
<script type="text/javascript">
$().ready(function() {
   $("#signupForm").validate({
     rules: {
         oldpass: "required",
         newpass: {
             required: true,
             minlength: 5
         },
         conpass: {
             required: true,
             minlength: 5,
             equalTo: "#newpass"
         },
     },
     messages: {
         oldpass: "Please enter oldpassword",
         newpass: {
             required: "Please enter newpassword",
             minlength: "Your password must be at least 5 characters long"
         },
         conpass: {
             required: "Please enter confirmpassword",
             minlength: "Your password must be at least 5 characters long",
             equalTo: "Please enter the same password as above"
         },
     }
   });
});
</script>
<section class="content-header">
   <div class="row">
      <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 bottom20">
         <h3 class="capital font15 padding5 bold">CHANGE PASSWORD</h3>
      </div>
   </div>
</section>
<hr class="bottom35">
<section class="hitz-top-header">
   <div class="row bottom40">
      <div class="col-xs-6">
         <div class="box box-success">
            <div class="box-body">
               <form action="user_management/update_password.php" method="post" enctype="multipart/form-data" class="common-frm-validation" id="signupForm">
                  <div class="row">
                     <div class="col-lg-12">
                        <div class="form-group">
                           <label class="capital">Old Password</label><span style="color: red">*</span>
                           <input class="form-control" placeholder="OLD PASSWORD" type="password" id="oldpass" name="oldpass" autofocus="">
                        </div>
                     </div>
                     <div class="col-lg-12">
                        <div class="form-group">
                           <label class="capital">New Password</label><span style="color: red">*</span>
                           <input class="form-control " placeholder="NEW PASSWORD" type="password" id="newpass" name="newpass">
                        </div>
                     </div>
                     <div class="col-lg-12">
                        <div class="form-group">
                           <label class="capital">Confirm Password</label><span style="color: red">*</span>
                           <input class="form-control " placeholder="CONFIRM PASSWORD" type="password" id="conpass" name="conpass">
                        </div>
                     </div>
                  </div>
                  <input type="hidden" value="<?php echo $_SESSION['login_id'];?>" name="id" id="id">

                  <input type="hidden" value="<?php echo $rows['password'];?>" name="old_pwd" id="old_pwd">

                  <hr>
                  <div class="row" align="center">
                     <button id="btn" class="btn btn-primary ajax-submit capital" type="submit"> Update & save </button>
                     <a href="index.php?page=dashboard.php" class="btn btn-danger capital"> Cancel</a>
                  </div>
               </form>
            </div>
         </div>
      </div>
   </div>
</section>