这不会使 $sel = 1 但它应该,为什么不呢?
$countryVar = 'SouthAfrica';
$day = 'South Africa';
$cutCountry = str_replace(" ", "", $day);
if($cutCountry == $CountryVar) {
echo '<option value="' . $cutCountry . '" selected>' . $row["Country"] . '</option>';
$sel = 1;
} else {
echo '<option value="' . $cutCountry . '">' . $row["Country"] . '</option>';
}
if($sel == 0) {
echo '<option value="na" selected>- Please Select Country -</option>';
}