$password = $_POST['password']; $un = $_POST['un']; $confirmpassword = $_POST['confirmpassword']; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailerr = "Invalid email"; echo $emailerr; } else { if (!($password == $confirmpassword)) { $passworderr = "Passwords Don't match"; echo $passworderr; } else { $a = $db->userExists($email); if ($a == true) { echo "email aldready exists"; } else { $db->storeUser($email, $password, $un); } } } } else { } ?> <form action="register.php" method="POST"> <strong> ALL FIELDS ARE MANDATORY </strong><br><br> email<br> <input type="text" name="email"><br><br> Username<br> <input type="text" name="un"><br><br> Password<br>