title: how to show selected item in edit form_dropdown codeigniter
body: <p>i have a problem to display the the selected item when at update/edit menu</p>
  
  <p>the item was not selected. how make it auto select?</p>
  
  <p>here my model</p>
  
  <pre><code>    public function master_kategorilapor(){
      $this-&gt;db-&gt;order_by('id_kategorilapor');
      $sql_kategorilapor=$this-&gt;db-&gt;get('kategorilapor');
      if($sql_kategorilapor-&gt;num_rows()&gt;0){
      return $sql_kategorilapor-&gt;result_array();
      }
  }
  </code></pre>
  
  <p>this the controller</p>
  
  <pre><code>    public function tambah_lapor(){
      $data['kategorilapor'] = $this-&gt;mymodel-&gt;master_kategorilapor();
      $dd_kategorilapor = array();
      foreach ($this-&gt;mymodel-&gt;master_kategorilapor() as $data_kategorilapor) 
      {
      $dd_kategorilapor[$data_kategorilapor['id_kategorilapor']] = $data_kategorilapor['nama_kategorilapor'];
      }
      $data['kategorilapor']=$dd_kategorilapor;
  
      $this-&gt;load-&gt;view ('petugas/tambah_lapor', $data);
  }
  </code></pre>
  
  <p>controller get update data</p>
  
  <pre><code>public function update_data ($id_lapor){
  
  
  $this-&gt;load-&gt;model("mymodel");
  $mhs = $this -&gt; mymodel -&gt; GetLapor("where id_lapor = '$id_lapor' ");
  $data = array(
      "id_lapor" =&gt; $mhs[0]['id_lapor'],
      "tgl_lapor" =&gt; $mhs[0]['tgl_lapor'],
      "t1" =&gt; $mhs[0]['t1'],
      "t2" =&gt; $mhs[0]['t2'],
      "dari" =&gt; $mhs[0]['dari'],
      "untuk" =&gt; $mhs[0]['untuk'],
      "id_tujuanlapor" =&gt; $mhs[0]['id_tujuanlapor'],
      "id_kategorilapor" =&gt; $mhs[0]['id_kategorilapor'],
      "isi_taruna" =&gt; $mhs[0]['isi_taruna'],
      "keterangan_taruna" =&gt; $mhs[0]['keterangan_taruna']);
  
  
  $this-&gt;load-&gt;view('petugas/update_lapor',$data);
  </code></pre>
  
  <p>}</p>
  
  <p>And this is my view</p>
  
  <pre><code>     &lt;?php echo form_dropdown("id_kategorilapor",$kategorilapor); ?&gt;
  </code></pre>