How to resolve header information warning

Asked

Viewed 14 times

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...

  • 1

    in short, you can’t make a echo and then try to apply a header(), because he must always come before any kind of exit...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.