[Solved] In select box option I want to search all the columns from mysql instead of one showing in dropdown option in php


I give here example for the data-attribute. You have to add your logic for searching the phone, it is a basic idea for select the option from the search match.

PHP code:

<select id="selectuser">
    <?php 
    foreach($db->selectboxoption($sql_fuel_type) as $data){ 
    echo '<option data-phone="'.$data["phone_no"].'" value="'.$data["type_category_id"].'">'.$data["type_category_name"] .'</option>'; 
    } 
    ?>    
</select>

Jquery code:

// your logic here(if phone no is match with your search phone)
$('#selectuser').find("option").filter(function() {
     return $(this).text() == $(this).data('phone');  
}).attr('selected',true);

2

solved In select box option I want to search all the columns from mysql instead of one showing in dropdown option in php