使用codeigniter中的下拉列表更改值货币

So I want to know if its possible to change value currency format using a dropdown menu, something like this :

enter image description here

I already asked and make a question about this before, but no one answer it

I have a table where I save the currency (is it really a good idea to put the currency option in a database?)

<label for="matauang" class="label-control">Currency</label>
         <select name="matauang" class="form-control" onchange = "changecurrency()" id="matauang">
        <option value="null" selected disabled>Choose</option>
        <?php foreach($payment as $pay) : ?>
        <option value="<?php $kurs = $pay["kurs"]; echo $kurs; ?>"><?php echo $kurs; ?></option>
  <?php endforeach; ?

this is what i tried

function calculateSubTotal() {
    let subtotal = 0.0;
    $('.calc').each(function() {
        subtotal += parseInt($(this).text());
    });

    let subtotal_discount = subtotal - (Math.round(($("#inputDiscount").val() / 100) * subtotal));
    let subtotal_tax = Math.round(($("#inputTax").val() / 100) * subtotal_discount);
    let subtotal_pph = Math.round(($("#inputpph").val()*subtotal_discount));
    let grandtotal = subtotal_discount + subtotal_tax + subtotal_pph;

    $("#subTotalDiscount").val(addCommas(subtotal_discount));
    $("#subTotalTax").val(addCommas(subtotal_tax));
    $("#SubTotalpph").val(addCommas(subtotal_pph));
    $("#grandTotal").val(addCommas(grandtotal));
    }

    function addCommas(moneyValue) {
        return moneyValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
        }

    function changeCurrency(){
        if $("#matauang").val() == "Dollar"{
            subtotal_discount / 13000);
            subtotal_tax / 13000);
            subtotal_pph / 13000);
            grandtotal / 13000);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 "))
        }else {
            $("#subTotalDiscount").val(addCommas(subtotal_discount));
            $("#subTotalTax").val(addCommas(subtotal_tax));
            $("#SubTotalpph").val(addCommas(subtotal_pph));
            $("#grandTotal").val(addCommas(grandtotal));
        }   
        }

help me :)