取消选中复选框codeigniter的声明

时间:2013-08-23 07:21:12

标签: codeigniter

我想做的是未经检查的条件。复选框。只有选中(复选框)才能正常工作 用于循环。如果未选中复选框,如何阻止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],

            );

1 个答案:

答案 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   
    }
}