在我看来:
<form method="post" action="<?php echo base_url(); ?>Data/Penilaian/Selected">
<table class="table datatable-responsive" id="example">
<thead>
<tr>
<th><button class="btn btn-info">Submit</button></th>
<th>No</th>
<th>Kendaraan</th>
<th>Plat Nomor</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$no=1;
if(!empty($getsifat)) {
foreach ($getsifat as $kr_key => $kendaraan) { ?>
<tr>
<td>
<?php foreach ($kendaraan['sub']['count'] as $data) { ?>
<input type="checkbox" name="id_kendaraan[]" value="<?php echo $kendaraan['id_kendaraan'] ?>">
<input type="hidden" name="total[]" value="<?php echo $data['total'] ?>" > //this my problem
<?php } ?>
</td>
<td><?php echo $no ?> </td>
<td><?php echo $kendaraan['nama'] ?> </td>
<td><?php echo $kendaraan['platno'] ?></td>
<?php
foreach ($kendaraan['sub']['count'] as $data) { ?>
<!-- <input type="hidden" name="total[]" value="<?php echo $data['total'] ?>"> -->
<td><?php echo $data['total'] ?></td>
<?php } ?>
</tr>
<?php
$no++;
}
}
?>
</tbody>
</table>
</form>
在视图中我想插入$id_kendaraan和$total值
如果我检查了 $id_kendaraan 2 并按提交,在我的数据库中数据 $id_kendaraan value = 2, $total value = 20, 是不正确的......在我的数据库中这个数据应该是 $id_kendaraan value = 2, $total value = 35
如果我尝试检查 $id_kendaraan 3 并按提交,在我的数据库中数据 $id_kendaraan value = 3, $total value = 20, 不正确...在我的数据库中这个数据应该是 $id_kendaraan value = 3, $total value = 44
如果我尝试检查 $id_kendaraan 2,3 并按提交,在我的数据库中数据 $id_kendaraan value = 2, $total value = 20 and $id_kendaraan value = 3, total value = 35, is not correct... in my db此数据应为 $id_kendaraan 值 = 2,$total 值 = 35 和 $id_kendaraan 值 = 3,$total 值 = 44
谢谢你的帮助
慕田峪4524236