I'm using php to select data from my database. I'm displaying it in a HTML select option tag. I have 100+ options and I want to hide which is the same as my selected data. For example:
<select class="form-control" id="type" name="type" required>
<option selected value='<?php echo $type; ?>'><?php echo $type; ?></option> // for example $type == "c"
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
For example the $type variable is "c". So it displays the option "c" twice. How can I easily hide always the one that I need if I have 100+ option values?
question from:
https://stackoverflow.com/questions/65642295/display-option-data-with-php-and-hide-the-similiar 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…