The following is my php code. I'm trying to make a form validation for registration, everything seems fine when I submit my form without filling in all the field. And when i try to fill up everything but purposely to mismatch the passwords, it somehow still allows me to register successfully.
if (isset($_POST['submitted']))
{
if (empty($_POST['useremail']))
$newemailerr = "Email is required!";
else
$newemail = ($_POST['useremail']);
if (empty($_POST['userid']))
$newiderr = "Username is required!";
else
$newid = ($_POST['userid']);
if (empty($_POST['userpass']))
$newpasserr = "Password is required!";
else
$newpass = ($_POST['userpass']);
if (empty($_POST['confirmpass'] && $_POST['confirmpass'] != $_POST['userpass']))
$newconfirmpasserr = "Both passwords do not match!";
else
$newconfirmpass = ($_POST['confirmpass']);
}