<div class="modern-language-wrapper">
  <label for="language_id" class="modern-language-label">
    <i class="fa fa-globe"></i> <?= $this->lang->line('language'); ?>
  </label>
  <select class="modern-language-select" id="language_id" name="language_id">
    <option value="" disabled selected><?= $this->lang->line('select_language'); ?></option>
    <?php 
    $lang_query = $this->db->query('select * from db_languages where status=1 order by language asc');
    $my_language = (!empty($this->session->userdata('language')) ) ? $this->session->userdata('language') : "English";

    foreach ($lang_query->result() as $res) {
      $selected = ($my_language == $res->language) ? "selected" : "";
      echo "<option $selected value='".$res->id."'>".$res->language."</option>";
    }
    ?>
  </select>
</div>