I am using https://semantic-ui.com/modules/dropdown.html plugin and I have to display the placeholder. I am retrieving data from the database which is working but the placeholder is not displaying.
Note:- If I remove PHP code than it is displaying placeholder.
I tried
$('select.dropdown').dropdown({placeholder:'select option'});
and also tried
<option value="" selected="selected" disabled >Select option</option>
but not working. Please check my code and assist me.
<select class="ui fluid search dropdown" id='select-super'>
<option value="">Select Option</option>
<?php while($row = mysqli_fetch_array($learn_teach_result)):;?>
<option value="<?php echo $row['email'];?>"><?php echo $row['email'];?></option>
<?php endwhile;?>
</select>
What I did. I add placeholder inside While. I don't know it is right or wrong but working for me.
Thanks, MR.Gibbok, With the help of your comment I got my solution
<select class="ui fluid search dropdown" id='select-super'>
<?php while($row = mysqli_fetch_array($learn_teach_result)):;?>
<option value="">Select Option</option>
<option value="<?php echo $row['email'];?>"><?php echo $row['email'];?></option>
<?php endwhile;?>
</select>
Try to use an option with no value, this data should be present in your array in the PHP.
Example:
<div class="another dropdown example">
<select class="ui dropdown">
<option value="">Gender</option> <!-- your placeholder -->
<option value="1">Male</option>
<option value="0">Female</option>
</select>
</div>
Try below code.
<select class="ui fluid search dropdown" id='select-super'>
<option value="">Select Option</option>
<?php while($row = mysqli_fetch_array($learn_teach_result)):;?>
<option value="<?php echo $row['email'];?>"><?php echo $row['email'];?></option>
<?php endwhile;?>
</select>