<form action="<?php bloginfo('url'); ?>" method="get">
<select name="cp_city" id="cp_city" onchange='return this.form.submit()'>
<?php
// get all the custom field labels so we can match the field_name up against the post_meta keys
$sql = "SELECT field_values FROM $wpdb->cp_ad_fields f WHERE f.field_name = 'cp_city'";
$results = $wpdb->get_row( $sql );
if ( $results ) {
$options = explode( ',', $results->field_values );
echo '<option selected="selected">Select a City</option>';
foreach ( $options as $option ) {
echo '<option value="'.$option.'">'.$option.'</option>';
}
}
?>
</select>
</form>
There are currently 1 users browsing this thread. (0 members and 1 guests)