• Hi,

    I want to display dynamic drop down by fetching values from database. In my functions.php file I have written below code :
    function cf7_dynamic_select_area(){
    global $wpdb;
    $results = $wpdb->get_results(“Select * from city_areas”);
    if(!empty($results)){
    echo “<select name=’id’>”;
    foreach($results as $result){
    $id = $result->city_id;
    $name = $result->city_name;
    echo ‘<option value=”‘.$id.'”>’.$name.'</option>’;
    }
    echo “</select>”;
    }
    }
    add_filter(‘city-filter’, ‘cf7_dynamic_select_city’, 10, 2);
    and in contact form using this short code : City : [dynamicselect* city id:city “city-filter”]
    So the problem is drop down is coming out of the form in <div class=”post-content”> instead of inside form. How to solve this issue?

    The page I need help with: [log in to see the link]

  • The topic ‘Dynamic select drop down displaying out of contact form 7’ is closed to new replies.