对于循环问题,将第三个数据视为未定义

时间:2011-08-13 06:59:47

标签: php arrays codeigniter for-loop

控制器

for ($x = 1; $x <= $numb; $x++) 
{
    echo $quanoutput = $this->input->post('quanoutput');
    $barcodeoutput = $this->input->post('barcodeoutput');
    $productsoutput = $this->input->post('productsoutput');
    $outward_date=$this->input->post('outward_date');
    $stock=$this->input->post('stock');
    $warehouse_id =$this->input->post('warehouse_id');
    $request_id =$this->input->post('request_id');
    $warehouse=$this->input->post('warehouse');
    $buyprice = $this->input->post('buyprice');
    if ($productsoutput=='undefined'){  
    //$flag3 =   $this->cartmodel->cartInsert($barcodeoutput,$quanoutput,$buyprice,$stock,$warehouse,$warehouse_id,$request_id,$outward_date);
    } else {
        $flag3 = $this->cartmodel->cartInsert($barcodeoutput,$quanoutput,$buyprice,$stock,$warehouse,$warehouse_id,$request_id,$outward_date);
    }
}

1 个答案:

答案 0 :(得分:0)

尝试在0开始你的for循环(即。j=0)并将<=更改为<