如果所有查询都插入到数据库中,尝试重定向到另一个页面,但它不会重定向而是显示警告而不是重定向。
警告:无法修改标题信息 - 已在第249行的C:\ wamp64 \ www \ quiz \ quiz.php中发送的标题(输出从C:\ wamp64 \ www \ quiz \ quiz.php:183开始)< / p>
我的代码 :(代码从行开始:180
直到EOF)
<h1><?php echo $it; ?>) <?php echo $Question; ?></h1></br>
<input type="hidden" name="tqid<?php echo $iii; ?>" value="<?php echo $QRN ?>">
<h2> <input type="radio" name="tradio<?php echo $iii; ?>" value="T"> True</h2>
<h2> <input type="radio" name="tradio<?php echo $iii; ?>" value="F"> False</h2>
</div>
<hr></br></br>
<?php
}
}
?>
<button class="btn btn-large btn-primary" type="submit" name="btn-submit">Submit</button>
</form>
<script src="<?php echo $web; ?>vendors/jquery-1.9.1.min.js"></script>
<script src="<?php echo $web; ?>bootstrap/js/bootstrap.min.js"></script><script src="<?php echo $users; ?>js/bootstrap.min.js"></script>
</body>
</html>
<?php
}
$asth = $user->runQuery("SELECT MAX(Sr) as Sr FROM answer");
$asth->execute();
$aresult = $asth->fetch(PDO::FETCH_ASSOC);
$atf= ($aresult['Sr']);
$aI = "1";
$acid = $atf + $aI;
$arn = $fddate.$ydate.$mdate.$frandno.$acid;
$count = $i;
for($j = 1; $j <= $count; $j++)
{
if(isset($_POST['btn-submit'])) {
$ufname = trim($_POST['radio'.$j]);
$Qrn = trim($_POST['qid'.$j]);
$istmt = $user->runQuery("INSERT INTO answer(ARN,Ans,QRN,SRN) VALUES(:user_arn, :user_crn, :user_qrn, :user_srn)");
$istmt->bindparam(":user_qrn",$Qrn);
$istmt->bindparam(":user_crn",$ufname);
$istmt->bindparam(":user_arn",$arn);
$istmt->bindparam(":user_srn",$srn);
$istmt->execute();
}
}
$fcount = $ii;
for($fj = 1; $fj <= $fcount; $fj++)
{
if(isset($_POST['btn-submit'])) {
$fufname = trim($_POST['fans'.$fj]);
$fQrn = trim($_POST['fqid'.$fj]);
$fistmt = $user->runQuery("INSERT INTO answer(ARN,Ans,QRN,SRN) VALUES(:user_arn, :user_fcrn, :user_fqrn, :user_srn)");
$fistmt->bindparam(":user_fqrn",$fQrn);
$fistmt->bindparam(":user_fcrn",$fufname);
$fistmt->bindparam(":user_arn",$arn);
$fistmt->bindparam(":user_srn",$srn);
$fistmt->execute();
}
}
$tcount = $iii;
for($tj = 1; $tj <= $tcount; $tj++)
{
if(isset($_POST['btn-submit'])) {
$tufname = trim($_POST['tradio'.$tj]);
$tQrn = trim($_POST['tqid'.$tj]);
$tistmt = $user->runQuery("INSERT INTO answer(ARN,Ans,QRN,SRN) VALUES(:user_arn, :user_tcrn, :user_tqrn, :user_srn)");
$tistmt->bindparam(":user_tqrn",$tQrn);
$tistmt->bindparam(":user_tcrn",$tufname);
$tistmt->bindparam(":user_arn",$arn);
$tistmt->bindparam(":user_srn",$srn);
$tistmt->execute();
$locationei = "result.php";
$locatione = $web.$locationei;
//$user->redirect($locatione);
header("Location: $locatione");
}
}
}
}
}
?>
答案 0 :(得分:0)
将PHP代码移至页面顶部,并在标题重定向语句后添加{{1}}。
所有HTML代码都追溯到以前的所有PHP代码。