<?php
$opt = $_GET['filter'];
$query = 'SELECT * FROM table WHERE filter=?';
$stmt = $pdo->prepare($query);
$stmt->execute([$opt]);
if($stmt->rowCount() > 0){
foreach($stmt as $element){
echo '<tr><td>'.$element[name].'</td></tr>';
}
}else{
echo '<tr><td>Нет данных по данному запросу.</td></td>'
}