sql pdo选择菜单值$ _POST

I made 2 populated selectmenu's to make queries to my sql database. The first option-tags of all select menu's have value="" Now everything works fine when I do select options of all 2 selectmenu's. But If I don't choose 1 or more options, the query doesn't work.

One of the select menu's:

<select name="titel" id="titel" value="">
    <option value="">Selecteer</option>
    <?php
    if($rowCount > 0){
        while($row = $query->fetch_assoc()){ 
            echo '<option  value="'.$row['titel'].'">'.$row['titel'].'</option>';
        }
    }else{
        echo '<option value="">Language not available</option>';
    }
    ?>
 </select>

2nd page (search.php):

<?php 
//load database connection
$host = "localhost";
$user = "...";
$password = "...";
$database_name = "...";
$pdo = new PDO("mysql:host=$host;dbname=$database_name", $user,  $password, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
// Search from MySQL database table

$titel=$_POST['titel'];
$version=$_POST['version'];

$query = $pdo->prepare("SELECT DISTINCT * FROM Library  where titel = ?  AND version = ?");

$query->bindValue(1, $titel, PDO::PARAM_STR);
$query->bindValue(2, $version, PDO::PARAM_STR);
$query->execute();

You can add check for that :

$sql = "SELECT DISTINCT * FROM Library";

if( (isset($_POST['titel']) && $_POST['titel'] != '') ) {    
  $sql .= " where titel =:titel";

  if ( (isset($_POST['version']) && $_POST['version'] != '') ) {    
    $sql .= " AND version =:version"; 
  }    
} 

if ( (isset($_POST['version']) && $_POST['version'] != '') && ! (isset($_POST['titel']) && $_POST['titel'] != '') ) {    
  $sql .= " where version =:version"; 
}

$query = $pdo->prepare($sql);    

if( (isset($_POST['titel']) && $_POST['titel'] != '') ) {
   $query->bindParam(':titel', $_POST['titel']);
}

if( (isset($_POST['version']) && $_POST['version'] != '') ) {
   $query->bindParam(':version', $_POST['version']);
}

$query->execute();