<!DOCTYPE html>
<!DOCTYPE html> <html> <head> <style type="text/css"> fieldset { width:500px; border:5px dashed #CCCCCC; margin:0 auto; border-radius:5px; } legend { color: blue; font-size: 25px; } dl { float: right; width: 390px; } dt { width: 180px; color: brown; font-size: 19px; } dd { width:200px; float:left; } dd input { width: 200px; border: 2px dashed #DDD; font-size: 15px; text-indent: 5px; height: 28px; } .btn { color: #fff; background-color: dimgrey; height: 38px; border: 2px solid #CCC; border-radius: 10px; float: right; } </style> </head> <body> <fieldset> <?php session_start(); $getname=$_SESSION['user']; $conn_db = mysql_connect("localhost","root","") or die(); $sel_db = mysql_select_db("diary",$conn_db) or die(); if(isset($_POST['re_password'])) { $old_pass=$_POST['old_pass']; $new_pass=$_POST['new_pass']; $re_pass=$_POST['re_pass']; $chg_pwd=mysql_query("select * from register where email='$getname'"); $chg_pwd1=mysql_fetch_array($chg_pwd); $data_pwd=$chg_pwd1['password']; if($data_pwd==$old_pass){ if($new_pass==$re_pass){ $update_pwd=mysql_query("update register set password='$new_pass' where email='$getname'"); echo "<script>alert('Update Sucessfully'); window.location='dailydiary.php'</script>"; } else{ } } else { }} ?> <form method="post"> <dl> <dt> Old Password </dt> <dd> <input type="password" name="old_pass" placeholder="Old Password..." value="" required /> </dd> </dl> <dl> <dt> New Password </dt> <dd> <input type="password" name="new_pass" placeholder="New Password..." value="" required /> </dd> </dl> <dl> <dt> Retype New Password </dt> <dd> <input type="password" name="re_pass" placeholder="Retype New Password..." value="" required /> </dd> </dl> <p align="center"> <input type="submit" class="btn" value="Reset Password" name="re_password" /> </p> </form> </fieldset> </body> </html>