标题调用错误PHP

时间:2016-03-15 13:26:02

标签: 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
    }
}

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

尝试使用isset()函数的if语句:

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` 
    } 

}