rendered paste body<?phprequire('incs/connection.inc.php');function city_list() { $dbh = new connect_mlsdb(); $dbh = $dbh->connection(); $city_query = 'SELECT DISTINCT town FROM [mls].[mlsadmin].[residential] ORDER BY town'; $city_return = mssql_query($city_query); while ($row = mssql_fetch_row($city_return)) { if (eregi('( AR| OK)', $row[0]) && $row != 'Charleston (Franklin Co) AR' && $row[0] != 'Mulberry (Franklin Co) AR' && $row[0] != 'Mansfield (Scott) AR') { $out1 = $row[0]; if (eregi('( \\(.*\\)| AR| OK)', $out1)) { $out2 = eregi_replace('( \\(.*\\)| AR| OK)', '', $out1); } if ($out2 == 'Other') { $out2 = "Other Unlisted City"; } } // Tried here and got just the first record // return "<option value=\"$out1\">$out2</option>"; } // Tried here and got just the last record return "<option value=\"$out1\">$out2</option>";}$output = city_list();echo "<select name=\"search_city\" class=\"advise_list_text\" id=\"search_city\">\n" . "<option selected>Select a value</option>\n$output";?>