In select box option I want to search all the columns from mysql instead of one showing in dropdown option in php -
from dropdown want search columns table
<?php foreach($db->selectboxoption($sql_fuel_type) $data) { echo '<option value="'. $data["type_category_id"] .'">'. $data["type_category_name"] .'</option>'; } ?> thanks in advance
i give here example data-attribute. have add logic searching phone, basic idea select option search match.
php code:
<select id="selectuser"> <?php foreach($db->selectboxoption($sql_fuel_type) $data){ echo '<option data-phone="'.$data["phone_no"].'" value="'.$data["type_category_id"].'">'.$data["type_category_name"] .'</option>'; } ?> </select> jquery code:
// logic here(if phone no match search phone) $('#selectuser').find("option").filter(function() { return $(this).text() == $(this).data('phone'); }).attr('selected',true);
Comments
Post a Comment