title: Display Data From Selected Value On the Select Tag to another Text Field
body: <p>I want to call 2 values from database, to be placed on <strong>select "dropdown"</strong> and on <strong>input type text</strong>.</p>
  
  <p>This might be considered as illustration :</p>
  
  <p><a href="https://i.stack.imgur.com/MNjhV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MNjhV.jpg" alt="enter image description here"></a></p>
  
  <p>When I select a <strong>vendor ID</strong>, I want attribute of selected value to be shown in <strong>Vendor Name</strong> field.
  How I should do?</p>
  
  <p>This is the code that i have to call the value for the  tag :</p>
  
  <blockquote>
    <p><strong>in model :</strong></p>
  </blockquote>
  
  <pre><code>function getAllGroups(){
  
     $query = $this-&gt;db-&gt;query('SELECT idvendor, vendorname FROM tbvendor');
  
  
              return $query-&gt;result();
  
              //echo 'Total Results: ' . $query-&gt;num_rows();
          }
  </code></pre>
  
  <blockquote>
    <p><strong>in Controller :</strong></p>
  </blockquote>
  
  <pre><code>public function addshipment(){
          $data['title']= 'Vendor ID';
          $data['groups'] = $this-&gt;m_shipment-&gt;getAllGroups();
  }
  </code></pre>
  
  <blockquote>
    <p><strong>in View :</strong></p>
  </blockquote>
  
  <pre><code>&lt;div class="form-group"&gt;
    &lt;label&gt;Vendor ID:&lt;/label&gt;
      &lt;div class="input-group"&gt;
         &lt;div class="input-group-addon"&gt;
             &lt;i class="fa fa-institution"&gt;&lt;/i&gt;
         &lt;/div&gt;
           &lt;select class="form-control input-box" name="idvendor"&gt;
              &lt;?php 
  
               foreach($groups as $row)
               { 
                echo '&lt;option value="'.$row-&gt;idvendor.'"&gt;'.$row-&gt;idvendor.'&lt;/option&gt;';
                  }
                  ?&gt; 
           &lt;/select&gt;
   &lt;/div&gt;      
  &lt;/div&gt; 
  </code></pre>
  
  <blockquote>
    <p>And this is table on my database</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/99oZo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/99oZo.png" alt="enter image description here"></a></p>
  
  <p>I'm already succeed to call the idvendor to place it on Select dropdown field, but i still can't get a way to place the vendorname into <strong>input type text</strong> when I select the idvendor.</p>
  
  <p>Hope someone can gimme an answer. 
  Thanks</p>