I want to have a form that updates mySQL database. The database is called userStuff. When I hit sumbit on my form, it just takes me to my php file and does not actually update the database. Any idea why? This is my html code:
<form method="post" name="update" action="update.php" />
Name: <input type="text" name="username" />
Password: <input type="text" name="password" />
<input type="submit" name="Submit" value="update" />
</form>
Here is my php code:
<?php
mysql_connect("localhost", "", "") or die("Connection Failed");
mysql_select_db("userStuff")or die("Connection Failed");
$username = $_POST['username'];
$password = $_POST['password'];
$query = "UPDATE test SET password = '$password' WHERE name = '$username'";
if(mysql_query($query)){
echo "updated";
}
else{
echo "fail";
}
?>