How to get id of selected option in dropdown?
<p>i want to get the id of selected option in dropdown.</p>

<p>I have a dropdow that displays company names from database. Now I want get the id of that company. How do i do that?</p>

<pre><code>&lt;select required name="org-list" id="org-list" class="form-control"&gt;    
    &lt;option value=""&gt;Select&lt;/option&gt;    
    &lt;?php foreach($org as $value) { ?&gt;              
        &lt;option id="org"  value="&lt;?php echo $value['org_name'];?&gt;"&gt;&lt;?php echo $value['org_name']; ?&gt;&lt;/option&gt;
    &lt;?php } ?&gt;
&lt;/select&gt;
</code></pre>

<p><strong>The Model</strong></p>

<pre><code>public function get_organisation()
{
    $q = $this-&gt;db-&gt;select('*') 
        -&gt;from('company') 
        -&gt;get(); 
    return $q-&gt;result_array(); 
}
</code></pre>

<p>And in my controller i want the id of selected option from database.</p>

<pre><code>$data = $this-&gt;key_m-&gt;array_from_post(array('id','org-list','keys'));
$data['keys'] = $license;
var_dump($data);
</code></pre>