0

How to store password in MYSQL ?

i created the new page,
index.html

<form action="calc.php" method="POST">
Username: <input type="text" name="username">
Password: <input type="password" name="password">
<input type="submit" name="submit" value="Submit">
</form>

and clac.php,

<?php
$username = $_POST['username'];
$pass = $_POST['password'];
if ($username == "a" && $pass =="abc")
/* here i set the password to "abc" */
	{
	echo 'Welcome to the Page';
	echo '<a href="cp.html">Change Pass</a>';
	}
else
	echo "Wrong";
	?>

and here is cp.html,

<form method="POST">
<input type="password" name="newpassword">
<input type="submit" name="submit">
</form>

i want to store that password in mysql and when a users clicks on change password and entered new password then the old password shoukld be replace by old password in mysql and it automatically set to the default value of password. , how can i do this ?
i am newbie in php and don't know how to store something in MYSQL

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by keval_hack
1

Hi Xufyan,

It looks like you have a lot to learn but have no fear i believe this resource will be fantastic for you to get to grips with what you want to do, and will also help you improve your login/registration files. Go to this link http://www.youtube.com/watch?v=h1Cv3zpWXj4

Enjoy and happy coding!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.