Tengo una página index2.php y en él tengo un include(anketa.php) Pero el problema es que en el archivo anketa.php tiene un header() por lo que cuando entro en mi página index2.php me da el clasico error:
Warning: Cannot modify header information - headers already sent by (output started at /www/sites/1/iespana.es/y/a/yamilds/site/index2.php:342) in /www/sites/1/iespana.es/y/a/yamilds/site/anketa.php on line 58
Ya intente poniendo el <? ob_start(); ?> al inicio y el otro code al final, pero sigue dando error. Cómo le puedo hacer.
Éste es el código de anketa.php:
Código HTML:
################################################################# # Script written 19.09.2004 by Pavol Srna # # Version: 1.0 # # Info:([email protected]) # ################################################################# include("var.php"); include ("configu.php"); //do premennej $hl*N sa vlozia nove udaje pre jednotlive moznosti if (isset($_POST["odpoved"])) { if ($_POST["odpoved"] == "A") {$a = 1;} else {$a = NULL;} if ($_POST["odpoved"] == "B") {$b = 1;} else {$b = NULL;} if ($_POST["odpoved"] == "C") {$c = 1;} else {$c = NULL;} if ($_POST["odpoved"] == "D") {$d = 1;} else {$d = NULL;} if ($_POST["odpoved"] == "E") {$e = 1;} else {$e = NULL;} $hl1N=$hl1+$a; $hl2N=$hl2+$b; $hl3N=$hl3+$c; $hl4N=$hl4+$d; $hl5N=$hl5+$e;} ################################################################################################ //Zapisu sa nove udaje poctov hlasov pre jednotlive moznosti do suborov hl*.txt if (isset($_POST["Submit"]) && isset($_POST["odpoved"]) && !isset($_COOKIE['hlasovanie'])) { $fp=fopen($subor1,"w"); fwrite($fp, $hl1N); fclose($fp); $fp=fopen($subor2,"w"); fwrite($fp,$hl2N); fclose($fp); $fp=fopen($subor3,"w"); fwrite($fp,$hl3N); fclose($fp); $fp=fopen($subor4,"w"); fwrite($fp,$hl4N); fclose($fp); $fp=fopen($subor5,"w"); fwrite($fp,$hl5N); fclose($fp); $fp=fopen($subor_hlasov,"w"); fwrite($fp,$hlasov+1); fclose($fp); setcookie('hlasovanie','ANO',time()+$timeout); header("Location: vysledky.php"); $sprava="Hlasovanie prebehlo uspesne";} elseif (isset($_COOKIE['hlasovanie'])) { header ("Location: vysledky.php"); $sprava="Uz ste hlasovali!";} if (!isset($_POST["odpoved"]) &&isset($_POST["Submit"])) {$sprava="Nezvolili ste Vasu odpoved!";} ################################################################################################## echo '<body bgcolor="',$pagebgcolor,'"></body>'; //formular ankety: echo '<table width="',$tableWidth,'" border="',$border,'" bgcolor="',$bgcolor,'" cellspacing="0" bordercolor="',$bordercolor,'"> <tr> <td> <p align="center"><font face="',$face,'" color="',$fontcolor,'" size="',$fontsizeAO,'"><b>',$anketnaOtazka,'</b></font></p> <form name="form1" method="post" action=""> <p style="margin-top: 0; margin-bottom: 0"> <input type="radio" name="odpoved" value="A"> <font face="',$face,'" color="',$fontcolor,'" size="',$fontsize,'">',$ot1,'</font> </p> <p style="margin-top: 0; margin-bottom: 0"> </p> <p style="margin-top: 0; margin-bottom: 0"> <input type="radio" name="odpoved" value="B"> <font face="',$face,'" color="',$fontcolor,'" size="',$fontsize,'">',$ot2,'</font> </p> <p style="margin-top: 0; margin-bottom: 0"> </p> <p style="margin-top: 0; margin-bottom: 0"> <input type="radio" name="odpoved" value="C"> <font face="',$face,'" color="',$fontcolor,'" size="',$fontsize,'">',$ot3,'</font> </p> <p style="margin-top: 0; margin-bottom: 0"> </p> <p style="margin-top: 0; margin-bottom: 0"> <input type="radio" name="odpoved" value="D"> <font face="',$face,'" color="',$fontcolor,'" size="',$fontsize,'">',$ot4,'</font></p> <p style="margin-top: 0; margin-bottom: 0"></p> <p style="margin-top: 0; margin-bottom: 0"> <input type="radio" name="odpoved" value="E"> <font face="',$face,'" color="',$fontcolor,'" size="',$fontsize,'">',$ot5,'</font></p> </p> <p align="center"> <input type="submit" name="Submit" value="Votar"> </td> </tr> </form> </table>' ; ######################################################################################################
