I append input field when click the add barcode button and i want to passing value to my controller and assign to my database but the value always 0 or ” how to assign to my database ?
when i call input name its produce empty value no actual input that we submited
Here my code
<form method="POST" action="<?php echo base_url('cabang/updatedatacabang') ?>" >
<tr height='30px;'>
<td>NO BARCODE APAR</td>
<td align='center'>:</td>
<td Colspan='2' width='10%'><input type="text" style="height:22px; width:160px; display:block; border:solid 1px #ADA3A3; border-radius:3px;" name="barcodeapar" title="barcode" AUTOCOMPLETE=OFF required></input></td>
</td>
<td>
<button onclick="add()">add Barcode</button>
<button onclick="remove()">remove Barcode</button>
</td>
</tr>
</form>
This what i append :
function add() {
var new_chq_no = parseInt($('#total_chq').val()) + 1;
var new_input = " <tr height='30px;' id='titik"+ new_chq_no + "'> <td width='60%' id='titik" + new_chq_no + "' > NO BARCODE APAR" + new_chq_no + "</td> <td align='center' id='titik" + new_chq_no + "'> : </td> <td Colspan='2' id='titik" + new_chq_no + "'> <input style='height:22px; width:160px; display:block; border:solid 1px #ADA3A3; border-radius:3px;' type='text' name='new_" + new_chq_no + "' id='new_" + new_chq_no + "' required> </td> </tr> ";
var last_chq_no = $('#total_chq').val();
if (last_chq_no < 5){
$('#new_chq').append(new_input);
$('#total_chq').val(new_chq_no);
}
}
</script>