How to show colors coming from a database in a [duplicate] drop-

0

I'm trying to put as an option in a select the color in place of the color name, I already did this using a div but never in a select, I have this code:

<div class="col-sm-6">
<div class="form-group selectpicker-wrapper">
    <label for="Cor">COR</label>
    <select id="Cor" name="Cor" class="selectpicker input-price" data-live-search="true" data-width="100%" data-toggle="tooltip" title="Select">
        <option>COR</option>
        <?php foreach ($ResCor as $ResCorSel) { ?>
        <option value="<?php echo $ResCorSel->IdCor ?>"><?php echo $ResCorSel->NomeCor; ?></option>
        <?php } ?>
    </select>
</div>

Where is:

<?php echo $ResCorSel->NomeCor; ?>

I would like to display the color, this field below brings a registered Hexa, but how to insert as a backgroud?

<?php echo $ResCorSel->Cor; ?>

This pink color that appears is from the script, none of the options checked helped me to solve the problem.

    
asked by anonymous 17.10.2018 / 02:29

0 answers