|
why i cannot update password in the database...below is showing the my code for update password...please help me..
<?php
session_start();
if(!(isset($_SESSION['valid'])))
{
}
if(isset($_POST['submit']) && $_POST['pass1']==$_POST['pass2'])
{
$db=mysql_connect("localhost","root","");
mysql_select_db("jmti",$db);
$password=$_POST['password'];
$username=$_SESSION['username'];
$sql="update tbuser set password='$password'where username='$username'";
$result=mysql_query($sql);
echo "succesfully updated";
echo "</br>";
}
elseif($_POST['pass1']!=$_POST['pass2'])
{
echo "both password filled are not same";
?>
<html>
<body>
<form method="post">
<table>
<tr>
<td>Type new password</td>
<td><input type="password" name="pass1"></td>
</tr>
<tr>
<td>Retype new password</td>
<td><input type="password" name="pass2"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit"></td>
</tr>
<tr>
</form>
</body>
</html>
<?php
}
else
{
?>
<html>
<body>
<form method="post">
<table>
<tr>
<td>Type new password</td>
<td><input type="password" name="pass1"></td>
</tr>
<tr>
<td>Retype new password</td>
<td><input type="password" name="pass2"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit"></td>
</tr>
<tr>
</table>
</form>
</body>
</html>
<?php
}
?>
|