how to automatically retrieve selected value
You need to use Form API Ajax. There you can see how to use it, Examples for developers include good ajax forms too.

Just remember, to set value to display, use $form_state['input'], not $form_state['values'].