Save plugin options in select box

I have plugin contains multiple field options all work perfectly. i have the select box below also work and save options without a problem

<select id="fonts" name="<?php echo $bsn_option; ?>[<?php echo $id1; ?>]" class="form-control">
    <?php foreach($items as $family): ?>
	<option value="<?php echo $family['family']; ?>" <?php echo selected($YPE_font[$id1], $family['family'], false); ?>><?php echo $family['family']; ?></option>
    <?php endforeach;?>
</select>

I added another select box by using PHP and JavaScript code as below

<select id="variants" name="<?php echo $bsn_option; ?>[<?php echo $id2; ?>]" class="form-control">
	
</select>

<script>
    jQuery(document).ready(function($){
        var items = <?php echo json_encode($jsItems);?>;
        $("#fonts").change(function(){
            var selectedFont = $(this).val();
            var variants     = items[selectedFont];
            $("#variants").html('');
            for (i = 0; i < variants.length; i++) {
                $("#variants").append('<option value="'+variants[i]+'">'+variants[i]+'</option>');
            }
        })
    });
</script>

My problem: I can’t save option values in this select box. How i can save options in this select box? Because when i click on Save settings button don’t save options and remain blank

I put this code echo selected($YPE_font[$id1], $family['family'], false); in to first select box to save options but i don’t know put any code in second select box antil can save options

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.