Jump to content

Warning: Cannot modify header information


Recommended Posts

Posted

Boas!

O problema é:

Estou a fazer um redireccionamento num ficheiro que é incluído a partir do index.php e depois surge-me esta mensagem! Pensei que era um problema comum de WhiteSpace, mas estive a limpar tudo e mesmo assim... nada! O erro (neste caso warning) no browser é este:

Warning: Cannot modify header information - headers already sent by (output started at /home/propedal/public_html/temp/index.php:15) in /home/propedal/public_html/temp/inscricao.php on line 61

O Código do index.php é este:

<?php if (!isset($_GET["view"])) {
$view="home.php";
} else {
$view=$_GET["view"].".php";
} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
	<title>Propedal</title>
    <link href="propedal.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="760" height="861" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="6">
		<img src="images/index_01.gif" width="760" height="155" alt=""></td>
</tr>
<tr>
	<td colspan="4">
		<img src="images/index_02.gif" width="379" height="16" alt=""></td>
	<td>
		<img src="images/index_03.gif" width="303" height="16" alt=""></td>
	<td>
		<img src="images/index_04.gif" width="78" height="16" alt=""></td>
</tr>
<tr>
	<td colspan="6">
		<img src="images/index_05.gif" width="760" height="29" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_06.gif" alt="" width="170" height="68" border="0" usemap="#Map"></td>
	<td rowspan="15">
		<img src="images/index_07.gif" width="24" height="514" alt=""></td>
	<td colspan="3" rowspan="15" bgcolor="#FFFFFF">
	<?php include ($view); ?>
  </td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_09.jpg" width="170" height="12" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.merida.com/" target="_blank"><img src="images/index_10.gif" alt="Website Merida" width="170" height="75" border="0"></a></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_11.gif" width="170" height="13" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.mondraker.com/" target="_blank"><img src="images/index_12.gif" alt="Website Mondraker" width="170" height="37" border="0"></a></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_13.gif" width="170" height="14" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.gtbicycles.com/" target="_blank"><img src="images/index_14.gif" alt="Website GT" width="152" height="48" border="0"></a></td>
	<td>
		<img src="images/index_15.gif" width="18" height="48" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_16.gif" width="170" height="18" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.bbbparts.com/" target="_blank"><img src="images/index_17.gif" alt="Website BBB" width="152" height="49" border="0"></a></td>
	<td>
		<img src="images/index_18.gif" width="18" height="49" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_19.gif" width="170" height="15" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.shimano.com/" target="_blank"><img src="images/index_20.gif" alt="Website Shimano" width="152" height="36" border="0"></a></td>
	<td>
		<img src="images/index_21.gif" width="18" height="36" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_22.gif" width="170" height="17" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.marzocchi.com/spa/mtb/?LN=UK&Sito=mtb" target="_blank"><img src="images/index_23.gif" alt="Website Marzocchi" width="152" height="38" border="0"></a></td>
	<td>
		<img src="images/index_24.gif" width="18" height="38" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<img src="images/index_25.gif" width="170" height="18" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.camelbak.com/" target="_blank"><img src="images/index_26.gif" alt="Website Camelbak" width="170" height="56" border="0"></a></td>
</tr>
<tr>
	<td colspan="6">
		<img src="images/index_27.jpg" width="760" height="146" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="152" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="18" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="24" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="185" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="303" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="78" height="1" alt=""></td>
</tr>
</table>
<map name="Map">
  <area shape="poly" coords="13,3,8,33,11,46,25,51,56,58,116,57,147,44,161,35,159,3" href="index.php?view=home" target="_self" alt="Home - Propedal">
</map>
</body>

</html>

O erro dá na linha 16 que corresponde à linha do início da TAG da <table>!

Se alguém puder ajudar... faça o favor.. já estou branco.

Se for possível.. contactem-me por msn: magnastik@yahoo.com.br

Abraços,

MagNastiK

Posted

Viva.

Estas a tentar usar uma header function depois de o header do HTML ja ter sido escrito em cima.

as funcoes header do php para serem usadas, tem que ser usadas no cabecalho. Ou seja, nao podes ter qq tipo de output antes de as usar.

por exmplo... nao podes fazer um echo e depois usar header( location...)

mas vou dar aqui uma olhadela mais atenta no codigo e ja te digo uma solucao

EDIT:

yeps.. isso mesmo...nesse ficheiro que incluis deves ter um header()

Os cabecalhos so devem ser enviados uma vez, eu costumo organizar o desenvolvimento dos meus projectos assim:

escrevo o codigo todo plano sem cabecalhos, depois comeco a definir cabecalhos de forma a que cada pagina contenha apenas um. depois vem o estilo, etc...

PS: pessoalmente abomino javascript, e nao o iria usar pois o php resolve.te esse problema e nao tem problemas de compatibilidade.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.