# How to obtain the selected value from collection\_select

**URL:** <https://www.ruby-forum.com/t/how-to-obtain-the-selected-value-from-collection-select/92045>\
**Category:** Rails\
**Created:** [April 15, 2007, 7:41am UTC](https://www.ruby-forum.com/t/how-to-obtain-the-selected-value-from-collection-select/92045 "2007-04-15T07:41:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zermoh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/2acd7d/32.png) [@zermoh](https://www.ruby-forum.com/u/zermoh)\
**Post date:** [April 15, 2007, 7:41am UTC](https://www.ruby-forum.com/t/how-to-obtain-the-selected-value-from-collection-select/92045/1 "2007-04-15T07:41:56Z")

</div>

Hi,  
I’m want to obtain the selected value from collection\_select and to use  
it  
to display something from the same table or other tables.  
There is my short code :

country name \<%= collection\_select(:country, :country\_id, @countries, :id, :name) %\>

by selecting a country id, my code should display the number of  
population, the capital  
and so one.

Do you have any idea?

Thanks
