2016-03-15 26 views
0

我越來越頭調用錯誤PHP

頭只能包含一個頭以上,新線檢測

從下面的頭調用

的地方,但完全不會有什麼意義,我.. 。我錯過了什麼?

// IF wristband is not assigned to attendee 
if ($wristassoc['attendid'] == '') { 
    // IF attendee does not have a wristband assigned 
    if ($attendwrist1['wristband'] == '') { 
     header("Location: updateform.php?result=6&attendid=".$attendid."&wristband=".$wristband."");// Enter PIN to assign 
    } else { 
     // IF attendee has a wristband, is it this one? 
     if ($attendwrist1['wristband'] == $wristband) { 
      header("Location: wristbandassignform.php?result=5&wristband=".$wristband." ");//Wristband already assigned to attendee 
     } else { 
      header("Location: updateform.php?result=4&attendid=".$attendid."&wristband=".$wristband.""); // Are you sure you want to update? 
     } 
    } 
} else { 
    // IF wristband is assigned to this attendee, IF not, wristband assigned to someone else, duplicate possible 
    if ($wristassoc['attendid'] == $attendid) { 
     header("Location: wristbandassignform.php?result=9&wristband=".$wristband."");//Wristband already assigned to attendee 
    } else { 
     header("Location: wristbandassignform.php?result=6");//Duplicate Possible 
    } 
} 

回答

3

變量$ attendid或$ wristband可能包含換行符。嘗試var_dump()/ print_r()這些變量來顯示它們的內容。

0

嘗試,如果有聲明isset()功能,如:

if (isset($wristassoc['attendid']) && !empty($wristassoc['attendid'])) { 
// IF attendee does not have a wristband assigned 
    if (isset($attendwrist1['wristband']) && !empty($attendwrist1['wristband'])) { 
     header("Location: updateform.php?result=6&attendid=" . $attendid . "&wristband=" . $wristband . ""); // Enter PIN to assign 
    } else { 
// IF attendee has a wristband, is it this one? 
     if (isset($attendwrist1['wristband']) == $wristband) { 
      header("Location: wristbandassignform.php?result=5&wristband=" . $wristband . " "); //Wristband already assigned to attendee 
     } else { 
      header("Location: updateform.php?result=4&attendid=" . $attendid . "&wristband=" . $wristband . ""); // Are you sure you want to update? 
     } 
    } 
} else { 
// IF wristband is assigned to this attendee, IF not, wristband assigned to someone else, duplicate possible 
    if (isset($wristassoc['attendid']) == $attendid) { 
     header("Location: wristbandassignform.php?result=9&wristband=" . $wristband . ""); //Wristband already assigned to attendee 
    } else { 
     header("Location: wristbandassignform.php?result=6"); //Duplicate Possible` 
    } 

}

+0

因此,如果上述聲明,其次是頭? –

+0

請看我編輯的答案。 –