I am a traniee yet, and I've been working out on this code to let a member change his password using $_POST method, but i am missing something and i cant find out what it is, any quick help will be very appriciated.
This is the page for form using post.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Change Password</title>
<style type="text/css">
<!--
body {margin: 0px}
-->
<body>
<form action="test.php" method="post">
Enter your email: <input type="text" name="email">
Enter your Present Password: <input type="password" name="oldpass">
Enter New Password: <input type="password" name="newpass1">
Re-enter New Password: <input type="password" name="newpass2">
<input type="submit" value="Submit">
</form>
</body>
</style></head>
</html>
and this is the page (test.php) where it will update password
<?php
session_start();
include 'connect_to_mysql.php';
$email = $_POST['email'];
$password = md5($_POST['oldpass'];
$newpassword = md5($_POST['newpass1'];
$confirmnewpassword = md5($_POST['newpass2'];
$result = mysql_query("SELECT password FROM members WHERE email='$email'");
if(!$result)
{
echo "The email you entered does not exist";
}
else
if($password!= mysql_result($result, 0))
{
echo "You entered an incorrect password";
}
if($newpassword=$confirmnewpassword)
$sql=mysql_query("UPDATE members SET password='$newpassword' where email='$email'");
if($sql)
{
echo "Congratulations You have successfully changed your password";
}
else
{
echo "The new password and confirm new password fields must be the same";
}
?>
It says "Parse error: syntax error, unexpected ';' in /home/u771899345/public_html/test.php on line 7"
I cant figure out what the problem is, please help!