-6

当我试图验证我的数据时,我得到了这个错误,我不明白为什么它是“意外”

//Requests fields from form on previous page  
 $CDID = $_REQUEST['CDID'];
 $CDTitle = isset($_REQUEST['CDTitle']) ? $_REQUEST['CDTitle'] :null;
 $CDYear = isset($_REQUEST['CDYear']) ? $_REQUEST['CDYear'] :null;
 $catID = isset($_REQUEST['catID']) ? $_REQUEST['catID'] :null;
 $pubID = isset($_REQUEST['pubID']) ? $_REQUEST['pubID'] :null;


if(empty($CDTitle) || (empty($CDYear) || (empty($catID) || (empty($pubID)){
die("<p> You must enter all fields</p>\n");}
4

3 回答 3

2

您的 if 语句应为:

if(empty($CDTitle) || empty($CDYear) || empty($catID) || empty($pubID)){

你有太多的括号,所以 php 期望看到更多的右括号来关闭你的条件。我已经删除了不必要的括号。

于 2012-11-23T15:23:08.513 回答
0

多余的括号..

改变:

if(empty($CDTitle) || (empty($CDYear) || (empty($catID) || (empty($pubID)){

至:

if(empty($CDTitle) || empty($CDYear) || empty($catID) || empty($pubID)){
于 2012-11-23T15:22:44.490 回答
0

) 失踪 :

if(empty($CDTitle) || (empty($CDYear) || (empty($catID) || (empty($pubID)){

应该 :

if(empty($CDTitle) || (empty($CDYear)) || (empty($catID)) || (empty($pubID))){

或者

if(empty($CDTitle) || empty($CDYear) || empty($catID) || empty($pubID)){
于 2012-11-23T15:23:57.167 回答