This question already has an answer here:
<select>
<?php
$connection = mysql_connect('localhost', 'root', '');
mysql_select_db('employees');
$query = "SELECT DISTINCT LEFT(from_date,4) AS date FROM salaries";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)){
$date = $row['date'];
echo '<option value="<?php echo $date ?>"><?php echo $date ?></option>';
echo $date;
}
mysql_close();
?>
</select>
When I'm using tag select options are getting empty values (nothing displays). When I'm deleting select and /select all values are appearing on the screen. Why is that happening and what's wrong with my code? I wish to display every date as an option.
</div>