if($_POST['sinitial']=="no")
{
$result = mysqli_query($con,"SELECT * FROM babyname WHERE (iname= '".$_POST['dinitial']."' AND gender= '".$_POST['gender']."' AND ncat= '".$_POST['ncat']."') OR (iname= '".$_POST['dinitial']."' AND gender= '".$_POST['gender']."')");
?>
I am trying to output names from the table babynames if the user inputs are desired intial >(dinitial) and gender and name category (ncat). But if the user doesnt want only the names >coming into a specific category else he wants to view all the names starting from the >dinitial than how should my query go ?