I have read quite a few posts on how to do this (Retain Selected Value PHP Dynamic Drop Down List), but cannot quite understand what to do. What I have works, but it does not retain the selected. Any help appreciated.
<form action="" method="POST" name="form1" id="form1">
<select name="selClass" size="1" id="selClass" onchange="form1.submit()">
<option value="">Select a class</option>
<?php
echo "<option value='" . "All records" . "' . >" . "all records" . "</option>";
while ($row1 = mysqli_fetch_array($rs5)) {
echo "<option value='" . $row1["class"] . "'>" . $row1["class"] . "</option>";
}
?>
</select>
</form>