I have 3 inputs. 'titlu' , 'etaj' and 'descriere' and when i want for exemple to search only on 'titlu' is not showing nothing but when i type in all 3 inputs its showing. Any suggestion to work and with only one input but to work with 3 inputs too.
Code:
<?php
$con = mysqli_connect("localhost","rent","123");
if (!$con)
{
die('Could not connect: ' . mysqli_error());
}
mysqli_select_db($con, "rent") or die("ERROR");
if(isset($_REQUEST['submit'])){
    $titlu=$_POST['titlu'];
    $etaj=$_POST['etaj'];
 $descriere=$_POST['descriere'];
    $sql=" SELECT * FROM apartament WHERE titlu like '%".$titlu."%' OR etaj like '%".$etaj."%' OR descriere like '%".$descriere."%'";
    $q=mysqli_query($con, $sql);
}
else{
    $sql="SELECT * FROM apartament";
    $q=mysqli_query($con, $sql);
}
?>
<form method="post">
    <table width="200" border="1">
  <tr>
    <td>Titlu</td>
    <td><input type="text" name="titlu" value="<?php echo $titlu;?>" /></td>
    <td>Etaj</td>
    <td><input type="text" name="etaj" value="<?php echo $etaj;?>" /></td>
     <td><input type="text" name="descriere" value="<?php echo $descriere;?>" /></td>
    <td><input type="submit" name="submit" value=" Find " /></td>
  </tr>
</table>
</form>
<table>
    <tr>
        <td>Titlu</td>
        <td>Etaj</td>
    </tr>
    <?php
    while($res=mysqli_fetch_array($q)){
    ?>
    <tr>
        <td><?php echo $res['titlu'];?></td>
        <td><?php echo $res['etaj'];?></td>
  <td><?php echo $res['descriere'];?></td>
    </tr>
    <?php }?>
</table> 
     
     
     
    