-1

我正在为一个项目制作一个 shoppingcart.php 文件,该文件由同一项目中另一个名为“catalog.php”的文件提供信息。我坚持的是while循环中的if语句(应该循环来自catalog.php的传入表单数据)。出于某种原因,它不喜欢这样:

//Loop through each form field (this page is called from catalog.php):        

    //If form field’s value (product quantity) is a positive number
//(nonzero), is NOT the submit button, AND the remove checkbox for 
//removing this product has NOT been checked (do these checks in one
    //condition):        
    while (list($productID,$qty) = each($_POST)){
        if(($qty > 0) && (type != submit) && (checkbox != isset())){

        }            
    }

我的 if 语句有什么问题?

4

1 回答 1

2

isset()错误地使用了 php。isset()需要一个变量参数和“[确定]是否设置了一个变量并且不是 NULL”。

尝试这个:

if (($qty > 0) && ($type != 'submit') && !isset($checkbox)) {

}
于 2013-05-04T18:12:36.107 回答