Drupal 7 Drupal7:在州、市和分支机构的3个下拉列表中选择,它应该用谷歌地图显示地址吗?我该怎么做?给我建议? 创建表单并将值存储在数据库中

Drupal 7 Drupal7:在州、市和分支机构的3个下拉列表中选择,它应该用谷歌地图显示地址吗?我该怎么做?给我建议? 创建表单并将值存储在数据库中,drupal-7,Drupal 7,$form[contact_options][state_select]=数组 type=>select, title=>t选择您所在的州, 选项=>$states\u类型, description=>t选择状态。, 'attributes'=>array'id'=>array'SelectType', 'onchange'=>'getStatethis.value', ; 从数据库中获取值 使用on change值时。若我选择state的值,那个么我将如何分配给另一个表单,并根据我从数据库中选

$form[contact_options][state_select]=数组 type=>select, title=>t选择您所在的州, 选项=>$states\u类型, description=>t选择状态。, 'attributes'=>array'id'=>array'SelectType', 'onchange'=>'getStatethis.value', ;

从数据库中获取值

使用on change值时。若我选择state的值,那个么我将如何分配给另一个表单,并根据我从数据库中选择的state得到城市的结果。
  $form['ver_ajax_dropdown']['state'] = array(
   '#title' => t('State'),
   '#type' => 'select',
   '#options' => _load_state(),
   '#ajax' => array(
   'event'=>'change',
   'callback' =>'ver_ajax_dropdown_city',
   'wrapper' => 'city-wrapper',
   ),
 );

  $options = array('- Select City -');
 if (isset($form_state['values']['state'])) {
 $options = _load_city($form_state['values']['state']);
}

$form['ver_ajax_dropdown']['city'] = array(
'#title' => t('City'),
'#type' => 'select',
'#prefix' => '<div id="city-wrapper">',
'#suffix' => '</div>',
 '#options' => $options,
'#ajax' => array(
  'event'=>'change',
  'callback' =>'ver_ajax_dropdown_branch',
  'wrapper' => 'branch-wrapper',
),
);

 $branch_options = array('- Select Branch -');
  if (isset($form_state['values']['city'])) {
   $branch_options = _load_branch($form_state['values']['city']);
 }

 $form['ver_ajax_dropdown']['branch'] = array(
  '#title' => t('Branch'),
  '#type' => 'select',
  '#prefix' => '<div id="branch-wrapper">',
  '#suffix' => '</div>',
  '#options' => $branch_options,
  '#ajax' => array(
  'wrapper' => 'contact_ajax_wrapper',
  'callback' => 'contact_form_ajax',
  ), 
 );

 function ver_ajax_dropdown_city($form, $form_state) {
  return $form['ver_ajax_dropdown']['city'];
 }
 function ver_ajax_dropdown_branch($form, $form_state) {
  return $form['ver_ajax_dropdown']['branch'];
 }
 function contact_form_ajax($form, $form_state) {
  return $form['results'];
  }


 function _load_state() {

  $state = array('- Select State -');
  $query = db_select("vercontact_mapping", "a");
  $query->distinct();
  $query->fields("a", array('state'));
  $query->orderBy("a.state");
  $result = $query->execute();

  while($row = $result->fetchObject()){
  $state[$row->state] = $row->state;
  }
  //print_r($province);
  return $state;
 }

 function _load_city($state) {
  $city = array('- Select City -');
  $query = db_select("vercontact_mapping", "a");
  $query->distinct();
  $query->fields("a", array('state','city'));
  $query->condition("a.state", $state);
  $query->orderBy("a.city");
  $query->groupBy("a.city");  
  $result = $query->execute();

 while($row = $result->fetchObject()){
  $city[$row->city] = $row->city;
 }
 //print_r($city);
  return $city;
 }
 function _load_branch($city) {
  $branch = array('- Select Branch -');
  $query = db_select("vercontact_mapping", "a");
  $query->distinct();
  $query->fields("a", array('city','branch'));
  $query->condition("a.city", $city);
  $query->orderBy("a.branch");
  $query->groupBy("a.branch");  
  $result = $query->execute();

  while($row = $result->fetchObject()){
   $branch[$row->branch] = $row->branch;
  }


 return $branch;
}