title: How to get selected option value in edit mode (codeigniter)
body: <p>i have form with options, when i want to edit it, the value goes back like in create function. what i want to ask is how to get the value i've selected in edit function?</p>
  
  <p>here is my model</p>
  
  <pre><code>  //get data by id
  public function get_data($id = FALSE){
      if($id === FALSE){
      $query = $this-&gt;db-&gt;get('forms');
      return $query-&gt;result_array();
      }
  
      $query = $this-&gt;db-&gt;get_where('forms', array('id' =&gt; $id));
      return $query-&gt;row_array();
  }
  </code></pre>
  
  <p>my controller</p>
  
  <pre><code>// get form by id
     public function get_data_id($id = NULL){
  
  
      $data['title'] = 'Update Data';
  
      $data['statuses'] = $this-&gt;status_model-&gt;get_status();        
      $data['form'] = $this-&gt;form_model-&gt;get_data($id);       
  
      if(empty($data['form'])){
          show_404();
      }
  
      $this-&gt;load-&gt;view('globals/header');
      $this-&gt;load-&gt;view('globals/navigation');
      $this-&gt;load-&gt;view('forms/edit_data', $data);
      $this-&gt;load-&gt;view('globals/footer'); 
  
  }
  </code></pre>
  
  <p>my edit view</p>
  
  <pre><code>&lt;?= form_open('forms/updating_data')?&gt;
      &lt;input type="hidden" name="id" value="&lt;?= $form['id']?&gt;" &gt;
          &lt;div class="form-group"&gt;
              &lt;label for="name"&gt;Name&lt;/label&gt;
              &lt;input type="text" class="form-control" name="name" value="&lt;?= $form['name']?&gt;"&gt;        
          &lt;/div&gt;           
          &lt;div class="form-group"&gt;
              &lt;label for="stat"&gt;Status&lt;/label&gt;
              &lt;select class="form-control" name="stat"&gt;
                  &lt;?php foreach($statuses as $stat):?&gt;
                      &lt;option value="&lt;?= $stat['status']?&gt;"&gt;&lt;?= $stat['status']?&gt;&lt;/option&gt;
                  &lt;?php endforeach; ?&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;button class="btn btn-primary btn-sm" type="submit"&gt;Update&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>can anyone help?</p>