Jazzy 1012
asked on
Form not operating correctly.
I have the code below I want the user to type in their passwords , then update it. But its not working, I echoed out the hash and it is correct, I dont know what else seems to be the issue, can anyone help?
<?php
require "connection.php";
if($_POST['submit'] == "true")
{
$hash = $_GET['hash'];
if($_POST['password'] != "" || $_POST['conpassword']!="")
{
$password = $_POST['password'];
$conpassword = $_POST['conpassword'];
$query = "UPDATE users SET password='$password' WHERE hash='$hash'";
mysqli_query($conn, $query)
or die(mysqli_error($conn));
echo "Thank you, your password has been changed.";
}
else{
echo "NO pass";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<link href = "http://fonts.googleapis.com/css?family=Roboto:400">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<style>
{
background-color:#fff;
-webkit-font-smoothing: antialiased;
font: normal 14px Roboto,arial,sans-serif;
}
.container {
padding: 25px;
position: fixed;
}
.form-login {
background-color: #EDEDED;
padding-top: 10px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
border-radius: 15px;
border-color:#d2d2d2;
border-width: 5px;
box-shadow:0 1px 0 #cfcfcf;
}
h4 {
border:0 solid #fff;
border-bottom-width:1px;
padding-bottom:10px;
text-align: center;
}
.form-control {
border-radius: 10px;
}
.wrapper {
text-align: center;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-offset-5 col-md-3">
<form action="" method="post">
<title> Welcome</title>
<div class="form-login">
<h4>Please enter your new Password</h4>
<input type="password" id="password" name= "password" class="form-control input-sm chat-input" placeholder="password" required />
</br>
<input type="password" id="password" name= "conpassword" class="form-control input-sm chat-input" placeholder="Re-enter password" required />
</br>
<div class="wrapper">
<span class="group-btn">
<input type="submit" class= "btn btn-primary btn md" value="Submit" >
</span>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.