if() problem
Posted: Fri Aug 07, 2009 7:38 pm
Hi,
I want to verify that the user has entered the correct password on a register page by making him enter it twice. However, if the passwords match or not, the same error comes up saying that they do not match. What am I doing wrong?
I want to verify that the user has entered the correct password on a register page by making him enter it twice. However, if the passwords match or not, the same error comes up saying that they do not match. What am I doing wrong?
Code: Select all
if(isset ($_POST['submit'])) {
$username = @mysql_escape_string($_POST['username']);
$password = @$_POST['password'];
$vpassword = @$_POST['vpassword'];
$email = @mysql_escape_string($_POST['email']);
if(@$_POST['password'] != @$_POST['vpassword']) {
echo 'Your passwords do not match';
}
elseif (!empty($username) && !empty($password) && !empty($email)) {
$query = mysql_query("INSERT INTO members (userid,username,password,email) VALUES ('0','".$username."','".$password."','".$email."')");
echo "You are now registered!";
}else{
echo 'You must enter a username, a password, and an e-mail address!';
}
} else { //echo form