$name = $_POST['name'];
$surname = $_POST['surname'];
$choice = $_POST['choice'];
$idcard= $_POST['idcard'];
$province= $_POST['province'];
if ($name != "" || $surname!= "" || $choice!= "" || $idcard!= "" || $province!= ""){
$sql = "SELECT * FROM ThaiIDCard inner JOIN Gender ON ThaiIDCard.gender = Gender.gender WHERE
(
nameT LIKE '%".$name."%'
OR nameE LIKE '%".$name."%'
AND surnameT LIKE '%".$surname."%'
OR surnameE LIKE '%".$surname."%'
AND idnum = '$idcard'
AND province = '$province'
)
Order by id
";
}
else{
$sql = "SELECT * FROM ThaiIDCard";
}