while ($city = mysql_fetch_array($result)) { echo "out.options[out.options.length] = new Option('".$city['name']."','".$city['city_id']."');\n"; }