I'm trying to search for supplier from the database using the bootstrap-select picker on the dropdown. What I want is while typing in a letter, the dropdown shows the relevant name from the database. The problem is, when I click the search bar, it doesn't show me the list of suppliers in the dropdown. what went wrong? I was able to see the list of suppliers in the dropdown before adding in the data-live-search and the select picker class.
<script>
$(document).ready(function(){
$('.search select').selectpicker();
})
</script>
<?php
//display supplier list on form
$supplier="SELECT * FROM supplier";
$sup_run=mysqli_query($conn,$supplier);
if(mysqli_num_rows($sup_run)> 0)
{
?>
<div class="form-group search" >
<label> Supplier Name</label>
<select class="selectpicker" data-live-search="true">
<option value=""> Choose a Supplier Company</option>
<?php
foreach($sup_run as $row)
{
?>
<option value="<?php echo $row['sup_id'];?>"><?php echo $row['sup_name'];?></option>
<?php
}
?>
</select>
</div>
<?php
}
else{
echo "No Data Available";
}
?>