I have some pretty simple code that is not doing what I want it to do. I just want it to take the unique numbers of the year category in my table and enter them into a dropdown box, but with this code I only get one option which says: $row['year']
Any help is appreciated.
<!DOCTYPE html>
<html>
<form name="testform" method='POST' action='mainck.php'>
<?Php
require "config.php";
echo "<br>Select year first <select name=year id ='s1' onchange=AjaxFunction();>
<option value=>Select a Year</option>";
$sql="SELECT DISTINCT year from PlayerRegSeason";
foreach ($dbo->query(&sql) as $row) {
echo "<option value=$row['year']>$row['year']</option>";
}
?>
</select>
</form>
</html>