It does not display the selected year from the drop down menu - which is what I am trying to accomplish. It prints up to "You choose" then it doesnt print the year. which is what i want to display.
<html>
<head><title> Hello </title>
<?php
//code for connection
include 'connect.php';
?>
</head>
<body>
<center>
<br>
<b>welcome</b>
<br>
<?php
$sql1 = "SELECT DISTINCT Year FROM dbnames ORDER BY Year";
$runsql1 = mysql_query($sql1);
if (!$runsql1)
{
die( "Could not execute sql:" . mysql_error());
}
while($row = mysql_fetch_array($runsql1))
{
$options .="<option>".$row['Year']."</option>";
}
$years = "<form id='filter1' name='filter1' method='post' action=''>
<select name='filter2' id='filter2'>".$options."</select></form>";
echo "Please choose an year".$years;
?>
<!-- submit button -->
<p><input type="submit" value="Submit"></p>
<?php
echo 'You choose'. $_POST[filter2];
?>
</center>
</body>
</html>