function outputFilteredCountries($dbAdapter)
{
    $term = $_GET["term"];
    $countryGate = new CountryTableGateway($dbAdapter);
    $result = $countryGate->filteredCountries($term);
    $countryInfoArray = [];
    foreach ($result as $row) {
        $countryInfo = new stdClass();
        $countryInfo->label = $row->CountryName;
        $countryInfo->value = $row->CountryName;
        array_push($countryInfoArray, $countryInfo);
    }
    echo json_encode($countryInfoArray);
}