Hello good afternoon I'm doing this code to select a country But the problem is that if you selected a country but it gives me the last one of the list how can I show the one I want
function pais ($dato, $name, $select, $tipo){
//--
$my_pais = array(
'de' => 'Alemania',
'mx' => 'Mexico',
'us' => 'Estados Unidos',
);
//--
if ($select){
echo "<select class=\"height_input data_input_two input__settings\" name=\"".$name."\" id=\"Language\">";
foreach ($my_pais AS $my_psais) {
echo '<option value="'.$my_psais.'" selected>'.$my_psais.'</option>';
}
echo "</select>";
}
//--
if ($select){
//--
}else{
return str_replace( array_keys($my_pais), array_values($my_pais), $dato);
}
}
echo pais('mx', 'pais', true, false);