Here are the HTML and JavaScript codes:
if (username == '' || password == '' || firstname == '' || secondname == '' || email == '') {
alert("Please fill all the fields!");
} else if ((password.length) < 8) {
alert("Password should have at least 8 characters in length!");
} else {
$.post("register.php", {
username1: username,
password1: password,
firstname1: firstname,
secondname1: secondname,
email1: email
},
function(data) {
if (data == 'You have successfully registered!') {
$("form-horizontal")[0].reset();
}
alert(data);
});
And the php: PHP
My problem is that no matter what the fields in the registration contain and/or if the username is in the database or not, I get the same error:
This username is already registered! Please, try again!