上面的表(文件a.php)是我插入值以传递到另一个页面的地方,正如您所看到的,我为唇膏插入值 1 ,值 10 测试, 当输出低于(文件b.php)时,您可以看到两者的值仅为10。有没有人可以帮助我?对于项目口红,值应为1.
下面是我的第一页有代码的代码,它名为a.php,它会将值传递给b.php
这是a.php中的表格,我故意将符号@@@帮助你去哪里看
<form method="post" action="b.php" name="Logreg" style="padding-left:35px; padding-bottom:35px; font-size:14px;">
<table class="table table-striped table-bordered">
<tr>
<th>Masa Masuk</th>
<th>No. Kes</th>
<th>Pegawai Serbuan</th>
<th>Kategori Barang</th>
<th>Perihal Barang</th>
<th>Jenama Barang</th>
<th>Kuantiti Barang</th>
<th>Pilih Bilangan</th>
<th>Rujukan Barang</th>
<th>Pilih</th>
</tr>
<?php
$sql = "select * from tbl_barang where view = 'y' && ";
$sql = $sql."eks_id = '".$_GET['eks_id']."'";
$result = $mydb->query($sql);
while ($detailrow = $result->fetch_array()) {
?>
<tr>
<td><?php echo $detailrow['tarikhjam']; ?></td>
<td><?php echo $detailrow['no_kes']; ?></td>
<td><?php echo $detailrow['nama']; ?></td>
<td><?php echo $detailrow['kategori_barang']; ?></td>
<td><?php echo $detailrow['perihal_barang']; ?></td>
<td><?php echo $detailrow['jenama_barang']; ?></td>
<td><?php echo $detailrow['kuantiti_barang']; ?></td>
@@@@@@@@@@@@<td><input type="text" name="kuantiti1" id="kuantiti1" size="1"></td>
<td><?php echo $detailrow['rujukan_barang']; ?></td>
<td>
<input name="barang_id[]" type="checkbox" value="<?php echo $detailrow["barang_id"]; ?>"id="<?php echo $detailrow["barang_id"]; ?>" onClick="toggle_2(this);" >
<br /><br />
</td>
</tr>
<?php } ?>
</table>
<input type="submit" class="btn btn-danger btn-mm" value="Cetak Borang Serah Ekshibit" />
</form>
解决这个问题,现在下面是我的第二页,即b.php,我也在下面的编码中放置符号@@@@@所以你们知道我怀疑代码中的问题...这是输出10显示的地方......
<table style='width:100%' class='table table-striped table-bordered'>
<tr>
<th>Bil.</th>
<th style='width:50%'>Perihal Barang</th>
<th style='width:70%'>Kuantiti</th>
</tr>
<?php
$count=count($_POST['barang_id']);
for($i=0; $i<$count; $i++)
{
$a=$_POST['barang_id'][$i];
$sql = "SELECT * FROM tbl_barang WHERE barang_id='$a'";
$sql2 = "SELECT * FROM tbl_rekod WHERE no_kes IN
(SELECT * FROM tbl_barang WHERE barang_id = '$a')";
$sql5 = "select tbl_barang.no_kes,tbl_rekod.no_kes,tbl_rekod.lokasi_kejadian from tbl_rekod
INNER JOIN tbl_barang on tbl_rekod.no_kes = tbl_home.no_kes
where tbl_barang.barang_id ='$a'"; //test test test
$result=$conn->query($sql);
$result2=$conn->query($sql2);
while($row = $result->fetch_assoc()){
$ab=$row['perihal_barang'];
$bc=$row['kuantiti_barang'];
$ca=$row['jenama_barang'];
$cak=$row['akta'];
?>
<tr>
<td align='center'><?php echo $io."." ?></td>
<?php $io++; ?> <?php ?>
<td align='center'><?php echo $ab ?></td>
<td align='center'><!--<?php echo $bc ?> baru ubah 8.11.2017-->
<?php
@@@@@@@@@@@@@ echo $_POST["kuantiti1"] // . " / " . $bc ; ?>
</td>
</tr>
<br/>
<?php
}
}
?>
</table>
我真的希望我的问题很容易让人理解..
答案 0 :(得分:0)
这是正常的,你的名字= kuantiti1只能包含一个值。
也许你可以试试这个:
<td><input type="text" name="kuantiti1[]" id="kuantiti1" size="1"></td>
其他步骤,您动态更改名称