Foros del Web » Programando para Internet » PHP »

erro al cargar el header

Estas en el tema de erro al cargar el header en el foro de PHP en Foros del Web. Tengo un problema al cargar mi pagina de ing_repa.php me el siguient emensaje de error: Warning: Cannot modify header information - headers already sent in ...
  #1 (permalink)  
Antiguo 27/02/2013, 11:58
 
Fecha de Ingreso: febrero-2010
Mensajes: 5
Antigüedad: 14 años, 2 meses
Puntos: 0
erro al cargar el header

Tengo un problema al cargar mi pagina de ing_repa.php me el siguient emensaje de error:
Warning: Cannot modify header information - headers already sent in C:\xampp\htdocs\faeot\ing_repartos.php on line 74


Necesito ayuda para saber que estoy haciendo mal, e leído muchos blog sobre el tema, indican que hay que tomar en cuenta los espacios, o que hay que enviar el header antes que codigo HTML, realmente estoy perdido, alguien que pueda ayudarme le agradezco mucho: acá dejo mi código.

Adicional estoy utilizando Dreamweaver CS6 para el desarrollo.

La linea 74 del error es esta: "header(sprintf("Location: %s", $insertGoTo));"



<?php
session_start();
if ( ! ($_SESSION['autenticado'] == 'SI' && isset($_SESSION['uid'])) )
{
?>
<form name="formulario" method="post" action="restriccion.php">
<input type="hidden" name="msg_error" value="2">
</form>
<script type="text/javascript">
document.formulario.submit();
</script>
<?php
}
include("/Connections/conectar_bd.php");
conectar_bd();
$sql = "SELECT tx_nombre,tx_apellidoPaterno,tx_TipoUsuario,id_usu ario
FROM tbl_users
LEFT JOIN ctg_tiposusuario
ON tbl_users.id_TipoUsuario = ctg_tiposusuario.id_TipoUsuario
WHERE id_usuario = '".$_SESSION['uid']."'";
$result =mysql_query($sql);
$nombreUsuario = "";
if( $fila = mysql_fetch_array($result) )
$nombreUsuario = $fila['tx_nombre']." ".$fila['tx_apellidoPaterno'];
mysql_close($conexio);?>
<?php
virtual('/faeot/Connections/conecta_faeot.php');
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO repartos (rep_nom) VALUES (%s)",
GetSQLValueString($_POST['rep_nom'], "text"));

mysql_select_db($database_conecta_faeot, $conecta_faeot);
$Result1 = mysql_query($insertSQL, $conecta_faeot) or die(mysql_error());

$insertGoTo = "/faeot/cons_repartos.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo)); ........esta es la linea 74........
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>biblioteca Virtual OT</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="/faeot/SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
<script src="/faeot/SpryAssets/SpryAccordion.js" type="text/javascript"></script>
</head>
<body>
<?php include("header2.php"); ?>
<div id="wrap">
<div id="header">
<h2 class="introtext"> FUERZA AEREA ECUATORIANA <span class="highlight2">Planeta Verde.</span> </h2>
</div>
<div id="contents">
<div class="clear"></div>
<div id="aboutdiv">
<h2>&nbsp;</h2>
<p>&nbsp;</p>
<!-- #BeginLibraryItem "/Library/menu.lbi" -->
<div id="Accordion1" class="Accordion" tabindex="0">
<div class="AccordionPanel">
<div class="AccordionPanelTab">
<p>INGRESO</p>
</div>
<div class="AccordionPanelContent">
<p><a href="/faeot/ing_repartos.php">Repartos</a></p>
<p><a href="/faeot/ing_aviones.php">Aviones</a></p>
<p><a href="/faeot/ing_tipoot.php">Tipo OT</a></p>
<p><a href="/faeot/ing_biblioteca.php">Biblioteca</a></p>
</div>
</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">
<p>MODIFICACIÓN</p>
</div>
<div class="AccordionPanelContent">
<p><a href="/faeot/mod_repartos.php">Repartos</a></p>
<p><a href="/faeot/mod_aviones.php">Aviones</a></p>
<p><a href="/faeot/mod_tipoot.php">Tipo OT</a></p>
<p><a href="/faeot/mod_biblioteca.php">Biblioteca</a></p>
</div>
</div>
<div class="AccordionPanel">
<div class="AccordionPanelTab">
<p>BAJAS</p>
</div>
<div class="AccordionPanelContent">
<p><a href="/faeot/baja_repartos.php">Repartos</a></p>
<p><a href="/faeot/baja_aviones.php">Aviones</a></p>
<p><a href="/faeot/baja_tipoot.php">Tipo OT</a></p>
<p><a href="/faeot/baja_biblioteca.php">Biblioteca</a></p>
</div>
</div>
</div>
<!-- #EndLibraryItem -->
<h2>&nbsp;</h2>
<p>&nbsp;</p>
</div>
<div id="homecontents">
<h2><a>Ingreso Repartos</a></h2>
<p><span class="openquote"></span></p>
<form action="<?php echo $editFormAction; ?>" method="post" id="form1">
<table>
<tr valign="baseline">
<td align="right">Reparto :</td>
<td><input type="text" name="rep_nom" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right">&nbsp;</td>
<td><input type="submit" value="Insertar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Mantener* un** sistema** seguro,** capaz* de** satisfacer* las** diferentes necesidades* de* aquellos* a* los* que* apoya,* actuando* con* flexibilidad, oportunidad, precisión, economía y seguridad.</p>
<p> El* sistema* consiste* en* entregar* el* material* necesario,* en* el* lugar adecuado, en el momento oportuno y en la cantidad precisa, para que las operaciones aeronáuticas se realicen a cabalidad.</p>

</div>
<div class="clear"></div>
</div>
</div>
<?php include("footer.php"); ?>
<script type="text/javascript">
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
</script>
</body>
</html>
  #2 (permalink)  
Antiguo 27/02/2013, 12:11
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: erro al cargar el header

Error clásico, aprender a buscar antes de abrir nuevos temas.

Lee lo siguiente: http://www.forosdelweb.com/wiki/PHP:...n_line_4%22%3F
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 28/02/2013, 16:28
Avatar de Reedyseth  
Fecha de Ingreso: enero-2009
Ubicación: Chihuahua, México
Mensajes: 419
Antigüedad: 15 años, 3 meses
Puntos: 36
Respuesta: erro al cargar el header

Tambien puedes agregar esto ob_start() en tu php despues de session_start()

Código PHP:
Ver original 

ob_start() le indica a php que no hay informacion en el buffer,

Tambien te invito a que pegues tu codigo con eh highlight ya que es mas facil de entender.
__________________
Reedyseth
Te ayudo? No olvides dar un +
blog:http://behstant.com/blog
En el blog:Tutoriales de Desarrollo Web PHP, Javascript, BD y más.

Etiquetas: erro, formulario, header, html, mysql, registro, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:35.