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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -