0
How can I resolve this warning? I’ve never seen it in my life, on my local server (localhost) does not give this warning, only on the hosting server...
Warning: Cannot Modify header information - headers already sent by (output Started at /home/lostscav/public_html/quiz/questao.php:25) in /home/lostscav/public_html/quiz/questao.php on line 30
The 30 line is that inside the Else
// $posicoes = isset($_SESSION['respostas']) ? count($_SESSION['respostas']) : 0;
$posicoes = count($_SESSION['respostas']);
echo $posicoes;
if ($_GET['idQuestao'] > $posicoes) {
//echo "n acontece nada!";
} else {
$voltaQuestao = $idQuestao + 1;
header("Location: questao.php?idQuestao=" . $voltaQuestao); // LINHA 30
}
if ($idQuestao > 10) {
header("Location: resultados.php");
}
I couldn’t get...
– viniciussvl
in short, you can’t make a
echo
and then try to apply aheader()
, because he must always come before any kind of exit...– Jader A. Wagner