Filter/Sort user comments

I’m a php newb so you’ll have to bear with me. I’m working on a user comment section where people can submit condition/snow reports for some backcountry cabins. I’ve got the submission and display part down but I’d like people to be able to filter the observations by hut so they can choose to see just the reports for a particular hut. I feel like I’m close but can’t seem to get the code to work. This is still just an in house mockup so that is why there’s no spam filter yet and some of the code may look a bit sloppy (inline styles, etc.) Thanks in advance, any suggestions are appreciated.

PHP

<?php
include $_SERVER['DOCUMENT_ROOT'] . '/includes/db2.inc.php';

if (isset($_POST['comment']))
{
try
{
$sql = 'INSERT INTO comments SET
comment = :comment,
name = :name,
contact = :contact,
hutname = :hutname,
date = CURDATE(),
time = CURTIME()';
$s = $pdo->prepare($sql);
$s->bindValue(':comment', $_POST['comment']);
$s->bindValue(':name', $_POST['name']);
$s->bindValue(':hutname', $_POST['hut']);
$s->bindValue(':contact', $_POST['email']);
$s->execute();
}
catch (PDOException $e)
{
$error = 'Error adding submitted observation: ' . $e->getMessage();
include 'error.html.php';
exit();
}
header('Location: .');
exit();
}


try
{
$sql = "SELECT name, comment, date, hutname FROM `comments` ORDER BY date DESC, time DESC";
$result = $pdo->query($sql);
}
catch (PDOException $e)
{
$error = 'Error fetching comments: ' . $e->getMessage();
include 'error.html.php';
exit();
}
while ($row = $result->fetch())
{
$comments[] = array(
'name' => $row['name'],
'date' => $row['date'],
'hutname' => $row['hutname'],
'comment' => $row['comment']
);
}


if (isset($_GET['search']))
{
include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
try
{
$sql = "SELECT name, comment, date, hutname FROM 'comments' WHERE hutname LIKE hut ORDER BY date DESC, time DESC";

$result = $pdo->query($sql);
}
catch (PDOException $e)
{
$error = 'Error fetching comments: ' . $e->getMessage();
include 'error.html.php';
exit();
}
while ($row = $result->fetch())
{
$comments[] = array(
'name' => $row['name'],
'date' => $row['date'],
'hutname' => $row['hutname'],
'comment' => $row['comment']
);
}
}
include 'comments.html.php';

HTML

<!DOCTYPE html>
<!--[if IE 8]> 				 <html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->

<head>
	<meta charset="utf-8" />
  <meta name="viewport" content="width=device-width" />
  <title>Current Conditions</title>
    <!-- Foundation 3 for IE 8 and earlier -->
<!--[if lt IE 9]>
	<link rel="stylesheet" href="../Foundation3/css/normalize.css">
	<link rel="stylesheet" href="../Foundation3/css/foundation.css">
	<link rel="stylesheet" href="../Foundation3/css/app.css">
<![endif]-->
<!-- Foundation 4 for IE 9 and earlier -->
<!--[if gt IE 8]><!-->
	<link rel="stylesheet" href="../css/normalize.css">
	<link rel="stylesheet" href="../css/foundation.css">
<!--<![endif]-->

  <link rel="stylesheet" href="../css/foundation.css" />
  <link rel="stylesheet" href="../css/10thMtn.css" />
  <script src="../js/vendor/custom.modernizr.js"></script>
<style type="text/css">
textarea {
display: block;
width: 100%;
}
</style>
</head>
<body>
<?php include('../includes/header.php'); ?>
<div class="row">
<div class="eight large-8 columns">
<h4>Here are the most current conditions:</h4>
<form action="" method="get">
	 <div class="row">
	<div class=" large-5 columns">
    <label>Sort by Hut:</label>
    <select name="hut" id="hut">
	<optgroup label="10th Mountain Huts">
	<option value="10th Mountain Division Hut">10th Mountain Division Hut</option>
	<option value="Benedict Huts">Benedict Huts</option>
	<option value="Betty Bear Hut">Betty Bear Hut</option>
	<option value="Continental Divide Cabin">Continental Divide Cabin</option>
	<option value="Point Breeze Cabin">Point Breeze Cabin</option>
	<option value="Eiseman Hut">Eiseman Hut</option>
	<option value="Fowler/Hilliard Hut">Fowler/Hilliard Hut</option>
	<option value="Harry Gates Hut">Harry Gates Hut</option>
	<option value="Jackal Hut">Jackal Hut</option>
	<option value="Margy's Hut">Margy's Hut</option>
	<option value="MacNamara Hut">MacNamara Hut</option>
	<option value="Peter Estin Hut">Peter Estin Hut</option>
	<option value="Polar Star Inn">Polar Star Inn</option>
	<option value="Carl's Cabin">Carl's Cabin</option>
	<option value="Sangree M. Froelicher Hut">Sangree M. Froelicher Hut</option>
	<option value="Shrine Mountain Inn">Shrine Mountain Inn</option>
	<option value="Skinner Hut">Skinner Hut</option>
	<option value="Uncle Bud's Hut">Uncle Bud's Hut</option>
	<option value="Vance's Cabin">Vance's Cabin</option>
	</optgroup>
	<optgroup label="Summit Huts">
	<option value="Francie's Cabin">Francie's Cabin</option>
	<option value="Francie's Cabin">Janet's Cabin</option>
	<option value="Francie's Cabin">Ken's Cabin</option>
	<option value="Francie's Cabin">Section House</option>
	</optgroup>
	<optgroup label="Grand Huts">
	<option value="Broome Hut">Broome Hut</option>
	</optgroup>
	<optgroup label="Braun &amp Friends Huts">
	<option value="Barnard Hut">Barnard Hut</option>
	<option value="Goodwin Greene Hut">Goodwin Greene Hut</option>
	<option value="Lindley Hut">Lindley Hut</option>
	<option value="Markley Hut">Markley Hut</option>
	<option value="Opa's Taylor Hut">Opa's Taylor Hut</option>
	<option value="Tagert &amp Green-Wilson Huts">Tagert &amp Green-Wilson Huts</option>
	<option value="Friends Hut">Friends Hut</option>
	</optgroup>
</select>
	</div>
	<button type="submit" value="search">Sort</button>
	</div>

</form>
<?php foreach ($comments as $comment): ?>
<div class="hutConditions">
<h6><?php echo htmlspecialchars($comment ['date'], ENT_QUOTES, 'UTF-8');
?> &nbsp <?php echo htmlspecialchars($comment ['hutname'], ENT_QUOTES, 'UTF-8');
?></h6>
<p><?php echo htmlspecialchars($comment ['name'], ENT_QUOTES, 'UTF-8');
?></p>
<blockquote>
<p><?php echo htmlspecialchars($comment ['comment'], ENT_QUOTES, 'UTF-8');
?>
</p>
</blockquote>
</div>
<?php endforeach; ?>
</div>
<div class="four large-4 columns">
<h5>Submit an Observation:</h5>
<form action="?" method="post">
<div>
<label for="name">Name</label>
<input type="text" name="name" id="name">
<label for="email">Email</label>
<input type="text" name="email" id="email">
<label for="hut">Hut</label>
<select name="hut" id="hut">
	<optgroup label="10th Mountain Huts">
	<option value="10th Mountain Division Hut">10th Mountain Division Hut</option>
	<option value="Benedict Huts">Benedict Huts</option>
	<option value="Betty Bear Hut">Betty Bear Hut</option>
	<option value="Continental Divide Cabin">Continental Divide Cabin</option>
	<option value="Point Breeze Cabin">Point Breeze Cabin</option>
	<option value="Eiseman Hut">Eiseman Hut</option>
	<option value="Fowler/Hilliard Hut">Fowler/Hilliard Hut</option>
	<option value="Harry Gates Hut">Harry Gates Hut</option>
	<option value="Jackal Hut">Jackal Hut</option>
	<option value="Margy's Hut">Margy's Hut</option>
	<option value="MacNamara Hut">MacNamara Hut</option>
	<option value="Peter Estin Hut">Peter Estin Hut</option>
	<option value="Polar Star Inn">Polar Star Inn</option>
	<option value="Carl's Cabin">Carl's Cabin</option>
	<option value="Sangree M. Froelicher Hut">Sangree M. Froelicher Hut</option>
	<option value="Shrine Mountain Inn">Shrine Mountain Inn</option>
	<option value="Skinner Hut">Skinner Hut</option>
	<option value="Uncle Bud's Hut">Uncle Bud's Hut</option>
	<option value="Vance's Cabin">Vance's Cabin</option>
	</optgroup>
	<optgroup label="Summit Huts">
	<option value="Francie's Cabin">Francie's Cabin</option>
	<option value="Francie's Cabin">Janet's Cabin</option>
	<option value="Francie's Cabin">Ken's Cabin</option>
	<option value="Francie's Cabin">Section House</option>
	</optgroup>
	<optgroup label="Grand Huts">
	<option value="Broome Hut">Broome Hut</option>
	</optgroup>
	<optgroup label="Braun &amp Friends Huts">
	<option value="Barnard Hut">Barnard Hut</option>
	<option value="Goodwin Greene Hut">Goodwin Greene Hut</option>
	<option value="Lindley Hut">Lindley Hut</option>
	<option value="Markley Hut">Markley Hut</option>
	<option value="Opa's Taylor Hut">Opa's Taylor Hut</option>
	<option value="Tagert &amp Green-Wilson Huts">Tagert &amp Green-Wilson Huts</option>
	<option value="Friends Hut">Friends Hut</option>
	</optgroup>
</select>
<label for="comment">Conditions/Observations:</label>
<textarea id="comment" name="comment" rows="3" cols="40">
</textarea>
</div>
<button type="submit" value="Add">Submit Observations</button>
</form>
</div>
</div>

<?php include('../includes/footer.php'); ?>


  <script>
  document.write('<script src=' +
  ('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
  '.js><\\/script>')
  </script>

  <script src="../js/foundation.min.js"></script>


</body>
<!-- Foundation 3 for IE 8 and earlier -->
<!--[if lt IE 9]>
    <script src="Foundation3/foundation.min.js"></script>
    <script src="Foundation3/app.js"></script>
<![endif]-->

<!-- Foundation 4 for IE 9 and later -->
<!--[if gt IE 8]><!-->
    <script src="/js/foundation4/foundation.min.js"></script>
    <script>
        $(document).foundation();
    </script>
<!--<![endif]-->
</html>

$sql = “SELECT name, comment, date, hutname FROM comments WHERE hutname LIKE hut ORDER BY date DESC, time DESC”;