'Empty criteria in query php to still show results?

I'm so sorry for the poorly made question, but I searched for 1 week for problem and now I don't even know anything... basically the query works but only if you fill all the 4 criteria(color,texture,taste,aftertaste) with the correct values.

What I want is if a person fills only criteria number1 (color) with 10, I want the query to result the ID number 1,2,3,4 (because only these ones have criteria color=10, as I painted in that poorly made table) and if he searched for color=10 and texture=10, only ID : 1,2,3 to show up, and so on. Right now with my code, it doesn't show anything even if you write color=10 but the others are left blank in the form. Please help, I'm begging you, I'm so sorry. If I'm missing something so obvious that I should have wrote here please tell me so I wont do it again please

 <form class="formular11" method="post" action="calculator.php">
            <div class="formularPart1">
            <label class="label2"for="fname">Color</label><br>
                <input type="text" id="color" name="color"><br>
            <label class="label2"for="lname">Texture</label><br>
                <input type="text" id="texture" name="texture"><br>
            <label class="label2"for="fname">Taste</label><br>
                <input type="text" id="taste" name="taste"><br>
            <label class="label2"for="fname">After taste</label><br>
                <input type="text" id="aftertaste" name="aftertaste"><br>

with the query

$sql = "select * from tot_specie where color='$_color' and texture='$_texture' and taste='$_taste' and aftertaste='$_aftertaste'"

$sql = "select * from tot_specie where color='$_color' " if I only use this, it shows all 4 of the which have the first color=10 but if I add the texture criteria and the user left it blank, the results are going to be 0, and so on if I added all 4 of them, and 3 of them are left empty, no results

+----------------------------------+
|ID|COLOR|TEXTURE|TASTE|AFTERTAASTE|
|----------------------------------|
|1 | 10  | 10    | 10  |   10      |
|2 | 10  | 10    | 10  |   11      |
|3 | 10  | 10    | 11  |   11      |
|4 | 10  | 11    | 11  |   11      |
|5 | 11  | 11    | 11  |   11      |
php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source