I want to get the selected SystemID
from my drop down menu which is populated by a database. I have named the drop down"data3"
Drop down from database is all working, it is displaying all the SystemIDs from my table.
Code below:
<select id ="data3" style="position:relative; top:-70px; left: 3.6%;"
name="data3" class="btn btn-light btn-sm dropdown-toggle">
<option value="SystemID">SystemID</option>
<?php
$sql = "SELECT DISTINCT SystemID FROM MyTable ORDER BY
SystemID";
$result = sqlsrv_query($conn, $sql);
while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
echo "<option value=\"\">" . $row['SystemID'] . "</option>";
}
?>
</select>
How do I get the selected value from that drop down? I have tried doing
var data3=$("#data3").val();
But this returns nothing