title: Codeigniter display data description based on selected dropdown id
body: <p>I want to display in the text field the corresponding description of the dropdown id that I selected. I will be using it to minus the days that corresponds to that id to the actual days it took to process a paper labeling the result as days delayed to perform the process. Example of this is the process was label printing and the corresponding days to do it is only 3 days but the actual process finished after 4 days having a 1 day delay. I am using codeigniter but I am having errors like invalid method. Please help. </p>
  
  <p>This is my controller,</p>
  
  <pre><code>$data['operation'] = $this-&gt;wip_model-&gt;get_operation();
  </code></pre>
  
  <p>This is the model,</p>
  
  <pre><code>function get_operation(){
      $this-&gt;db-&gt;select('OperationName');
      $this-&gt;db-&gt;select('DeliveryDays');
      $this-&gt;db-&gt;from('operation');
      $query = $this-&gt;db-&gt;get();
      $result = $query-&gt;result_array();
  
      return $result;
  }
  </code></pre>
  
  <p>This is my view snippet,</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="control-label"&gt;Operation&lt;/label&gt;
      &lt;select class="form-control" id="operation" name="operation"&gt;
         &lt;option value=""&gt;-SELECT-&lt;/option&gt;
         &lt;?php foreach($operation as $val){ ?&gt;
         &lt;option value="&lt;?php echo $val['OperationName'];?&gt;"&gt;
         &lt;?php echo $val['OperationName'];?&gt;&lt;/option&gt;
         &lt;?php } ?&gt;
      &lt;/select&gt;
      &lt;span class="text-danger"&gt;&lt;?php echo form_error('operation');?&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried to put a hidden textbox after the select option but I am having unexpected results like instead of displaying number of days corresponds to the selected value, it displays the next items to be displayed by select option. I hope my english is not that bad and may you get the logic that I am presenting...</p>
  
  <p>I search and found this code:</p>
  
  <pre><code>function showDays(str){
      $.get("&lt;?php echo site_url('wip/get_deliverydays');?&gt;",{q:str},function(data){
          $("#deliverydays").html(data);
      });
  }
  </code></pre>
  
  <p>I thought it will now work but I am having now a Uncaught ReferenceError: showDays is not defined...</p>