title: Wordpress Custom taxonomy dropdown with childen and hierarchy
body: <p>I'm using a property theme for wordpress for my venue based project. In there ive got a search that is based on the custom taxonomies, the one i need help with is the location. </p>
  
  <p>Initially i had Country and City - but after finding that i couldn't seem to populate the cities based on what the user selected for the country (AJAX i though but i cant figure out how to do it even after surfing the net for hours). I saw a post that said to make it into one taxonomy which i called Location, this now is a hierarchal taxonomy which has a cities as children</p>
  
  <p>what i'm having a problem with is that for the search i've got a dropdown now which is showing the cities but not with the hierarchy! </p>
  
  <p>so it look like (for example)</p>
  
  <p>Brazil<br>
  Florence<br>
  Italy<br>
  Mexico<br>
  United States  </p>
  
  <p>where it should be showing it as</p>
  
  <p>Brazil<br>
  Italy<br>
  -Florence<br>
  Mexico<br>
  United States  </p>
  
  <p>the dropdowns are all called like </p>
  
  <pre><code>&lt;div class="left"&gt;
      &lt;label for="ct_state"&gt;&lt;?php _e('Location', 'contempo'); ?&gt;&lt;/label&gt;
      &lt;?php ct_search_form_select('country'); ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The function that is called is</p>
  
  <pre><code>function ct_search_form_select($name, $taxonomy_name = null) {
      global $search_values;
  
      if (!$taxonomy_name) {
          $taxonomy_name = $name;
      }
      ?&gt;
      &lt;select id="ct_&lt;?php echo $name; ?&gt;" name="ct_&lt;?php echo $name; ?&gt;"&gt;
          &lt;option value="0"&gt;&lt;?php _e('Any', 'contempo'); ?&gt;&lt;/option&gt;
          &lt;?php foreach( get_terms($taxonomy_name, 'hide_empty=0') as $t ) : ?&gt;
              &lt;?php if ($search_values[$name] == $t-&gt;slug) { $selected = 'selected="selected" '; } else { $selected = ''; } ?&gt;
              &lt;option &lt;?php echo $selected; ?&gt;value="&lt;?php echo $t-&gt;slug; ?&gt;"&gt;&lt;?php echo $t-&gt;name; ?&gt;&lt;/option&gt;
          &lt;?php endforeach; ?&gt;
      &lt;/select&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>As you can see it also pulls a variable called $search_values which is how im compiling all the selections into a search query. Is there is quick fix for this anywhere? i've tried doing different functions and i just cant get anything to work :( please someone help me</p>
  
  <p>thanks so much
  nickey</p>