foreach ($subresult AS $key) if ($nyear1!= $key){ echo "<option value=$key>$key</option>"; }else echo "<option value=$key selected=nyear1>$key</option>";