标头调用错误 PHP


Header Call Error 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
    }
}

变量 $attendid 或 $wristband 可能包含换行符。尝试对这些变量进行 var_dump()/print_r() 以显示其内容。

尝试 if 语句,函数如下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` 
    } 

}