How to display the selected value from the drop-down box? The following code is displaying the states, but when I click the submission button, I want to display the selected state and city. I am not able to display it. How can I achieve this?   

$form['state1'] = array(
  '#type' =&gt; 'select',
  '#title' =&gt; t('State'),
  '#options' =&gt; $options_state,
  '#required' =&gt; TRUE,
  '#ajax' =&gt; array(
    'callback' =&gt; '_ajaxfunction',
    'wrapper' =&gt; 'divaroundseconddropdown'
  ),
);


$form['city_element_wrapper'] = array(
    '#prefix' =&gt; '&lt;div id="divaroundseconddropdown"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
);


function _ajaxfunction($form, $form_state) { 
  $key = !empty($form_state['values']['state1']) ? $form_state['values']['state1'] : 1;
  $query_city=db_select('city', 'c');
  query_city-&gt;fields('c',array('District_Code','District_Name','State_Code'));
  $query_city-&gt;condition('State_Code', $key, '=');

  $query_city-&gt;orderBy('District_Name','ASC');
  $city_results = $query_city-&gt;execute();
  $options_city = array();

  foreach ($city_results as $city_record) {
    // This is correct.
    $options_city[$city_record-&gt;District_Code]=t($city_record-&gt;District_Name);
  }

  // Render city setting.
  $form['city_element_wrapper']['city'] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; t('District'),
    '#options' =&gt; $options_city,
    '#required' =&gt; TRUE,);

  return $form['city_element_wrapper']; 
}


The following code is not working properly:

function form_test_form_submit($form, $form_state) {
  echo $prog_state = $form_state['values']['state1'];
  echo $data1 = $form_state['values']['city_element_wrapper'];
}
form_test_form_submit is called in php that's not displayed to user. Form is processed, it's values saved, and user is taken to desired page. Now you have 2 options:


In submit handler set$form_state['redirect'] to a page you like. Save values to a database. On target page read them and display.
In validation handler add markup elements with selected values, if you want to emphasize selection but leave user on a form.