foreach( $codes as $code and $names as $name ) { }
That is not valid.
You probably want something like this…
foreach( $codes as $index => $code ) {
echo '<option value="' . $code . '">' . $names[$index] . '</option>';
}
Alternatively, it’d be much easier to make the codes the key of your $names
array…
$names = array(
'tn' => 'Tunisia',
'us' => 'United States',
...
);