我在页面上有一个表单来提交评论,一旦用户发表评论,我希望它重新加载页面。
这就是我得到的
$insertGoTo = "employer.php?employer=" . $row_employer_page['employer'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
它有效,但是我在提交时收到此错误。
Notice: Undefined variable: row_employer_page in /u/students/m/*******/public_html/cis231/project/employer.php on line 51
Warning: Cannot modify header information - headers already sent by (output started at /u/students/m/*******/public_html/cis231/project/employer.php:51) in /u/students/m/*******/public_html/cis231/project/employer.php on line 56
它引用的行是我在上面发布的代码。我不确定发生了什么,它会按照我想要的方式重新加载页面,但会抛出该错误