So I'm trying to compare a $_POST value to my database and if it matches then echo 'Already taken.Input another'. But it doesn't seem to work..So I'm trying to compare a $_POST value to my database and if it matches then echo 'Already taken.Input another'. But it doesn't seem to work..
//if form has been submitted process it
if(isset($_POST['submit'])){
//collect form data
extract($_POST);
//very basic validation
if($idnumber ==''){
$error[] = 'Please enter the ID Number.';
}
if($password ==''){
$error[] = 'Please enter the password.';
}
if($passwordConfirm ==''){
$error[] = 'Please confirm the password.';
}
if($password != $passwordConfirm){
$error[] = 'Passwords do not match.';
}
if($fullname ==''){
$error[] = 'Please enter the Full Name.';
}
if($role ==''){
$error[] = 'Please select a role type.';
}
$idmatch=$mysqli->query('SELECT idNUMBER from members where idnumber=$idnumber');
if (mysqli_num_rows($idmatch)==1) {
echo'Id number already taken';
}?>