I want to move the name attribute, to be a hidden value (not id), but ... stored in the database that is still id
<div class="form-group col-md-4">
    <select name="id_cs" id="pakyu" class="form-control select2" style="width: 100%;" onchange="ganti();">
        <option value="0">-PILIH-</option>
        <?php foreach($datacs->result() as $row):?>
        <option value="<?php echo $row->id_cs;?>"><?php echo $row->nama_cs;?></option>
        <?php endforeach;?>
        <input type="hidden" id="csnya" name="nama_cs">
    </select>
</div>
jquery
function ganti() {
    var reg = $('#pakyu option:selected').val();
    $('#csnya').val(reg);
}
 
     
    