我想做的是未经检查的条件。复选框。只有选中(复选框)才能正常工作 用于循环。如果未选中复选框,如何阻止foreach运行?
示例循环。
$count = count($waybillno);
for ($i = 0; $i < $count; $i++) {
$data = array(
'waybillno' => $waybillno[$i],
'quantity' => $quantity[$i],
'waybilldate' => $waybilldate[$i],
'declared_value' => $declared_value[$i],
'consignee' => $consignee[$i],
);
答案 0 :(得分:0)
<强> EDITED 强>
尝试:
$count = (count($waybillno));
for ( $i = 0; $i < $count; $i++ ) {
if( isset( $waybillno[$i] ) && $waybillno[$i] != "" ){
$data = array(
'waybillno' => $waybillno[$i],
'quantity' => $quantity[$i],
'waybilldate' => $waybilldate[$i],
'declared_value' => $declared_value[$i],
'consignee' => $consignee[$i],
);
#update query here
}
}