[thelist] Query selected

Andrew andrew at humanbehaviour.co.uk
Tue Mar 4 07:25:01 CST 2003


Can anyone tell me why this 'selected' isn't working?  It does keep a fixed id
selected but not the one that was selected and aslo doesn't return any results?

echo "<select name=\"CityID\" size=\"1\" class='menuForm'>";

$result=mysql_query("SELECT City, CityID FROM city ORDER BY City");
while ($row = mysql_fetch_array($result))
    {
        $city_id=$row['CityID'];
		$city=$row['City'];

echo "<option value=\"$city_id\" selected> $city </option>";
}
echo "</select>";

Andrew




More information about the thelist mailing list