Foros del Web » Programando para Internet » PHP »

Cannot modify header information

Estas en el tema de Cannot modify header information en el foro de PHP en Foros del Web. saludos.... estaba haciendo un registro de recursos humanos y me funcionaba a la perfeccion... ahora bien ingrese solo 5 campos mas pero me da este ...
  #1 (permalink)  
Antiguo 16/06/2008, 13:59
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Cannot modify header information

saludos....
estaba haciendo un registro de recursos humanos y me funcionaba a la perfeccion... ahora bien ingrese solo 5 campos mas pero me da este error

Warning: Cannot modify header information - headers already sent by (output started at /home/indexa/public_html/latiendadelpintor/unete.php:15) in /home/indexa/public_html/latiendadelpintor/ficha_empleos.php on line 151

siendo la linea 151 esta
Código PHP:
 header(sprintf("Location: %s"$insertGoTo)); 
y la declaracion completa es

Código PHP:
<?php require_once('Connections/pintor.php'); 
if (!
function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$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 "'" "''";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "''";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "''";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "''";
      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")) {

$ediciondir'fotos/';  
$uploaddir=$ediciondir;
if (!
is_dir($ediciondir)) {     mkdir($uploaddir0777);    }
move_uploaded_file($_FILES['imagen']['tmp_name'], $uploaddir $_FILES['imagen']['name']);    
$filename $_FILES['imagen']['name'];

  
$insertSQL sprintf("INSERT INTO rrhh (id, nombres, apellidos, email, pais, estado, ciudad, urbanizacion, calle, casa, piso, telcasa, telcelular, nacionalidad, cedpas, numerodoc, fechanac, sexo, estadocivil, imagen, objetivos, cargo, relacion, tipotrabajo, sueldo, cambiociudad, desde, hasta, empresa, dir_empresa, cargo_empresa, jefe, cargo_jefe, terminacion, sueldo_final, desde2, hasta2, empresa2, dir_empresa2, cargo_empresa2, jefe2, cargo_jefe2, terminacion2, sueldo_final2, desde3, hasta3, empresa3, dir_empresa3, cargo_empresa3, jefe3, cargo_jefe3, terminacion3, sueldo_final3, instituto, dir_instituto, anos_cur, inicio_inst, final_inst, titulo, instituto2, dir_instituto2, anos_cur2, inicio_inst2, final_inst2, titulo2, instituto3, dir_instituto3, anos_cur3, inicio_cur3, final_cur3, titulo3, instituto4, dir_instituto4, anos_cur4, inicio_inst4, final_inst4, titulo4, instituto5, dir_instituto5, anos_cur5, inicio_inst5, final_inst5, titulo5, nomape, direccion_ref, tel_ref, tiempo_ref, nomape2, direccion_ref2, tel_ref2, tiempo_ref2, povehiculo, modelovehi, anovehi, licenpos, licengrado) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['id'], "int"),
                       
GetSQLValueString($_POST['nombres'], "text"),
                       
GetSQLValueString($_POST['apellidos'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['estado'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['urbanizacion'], "text"),
                       
GetSQLValueString($_POST['calle'], "text"),
                       
GetSQLValueString($_POST['casa'], "text"),
                       
GetSQLValueString($_POST['piso'], "text"),
                       
GetSQLValueString($_POST['telcasa'], "text"),
                       
GetSQLValueString($_POST['telcelular'], "text"),
                       
GetSQLValueString($_POST['nacionalidad'], "text"),
                       
GetSQLValueString($_POST['cedpas'], "text"),
                       
GetSQLValueString($_POST['numerodoc'], "text"),
                       
GetSQLValueString($_POST['fechanac'], "date"),
                       
GetSQLValueString($_POST['sexo'], "text"),
                       
GetSQLValueString($_POST['estadocivil'], "text"),
                       
GetSQLValueString($filename"text"),
                       
GetSQLValueString($_POST['objetivos'], "text"),
                       
GetSQLValueString($_POST['cargo'], "text"),
                       
GetSQLValueString($_POST['relacion'], "text"),
                       
GetSQLValueString($_POST['tipotrabajo'], "text"),
                       
GetSQLValueString($_POST['sueldo'], "text"),
                       
GetSQLValueString($_POST['cambiociudad'], "text"),
                       
GetSQLValueString($_POST['desde'], "text"),
                       
GetSQLValueString($_POST['hasta'], "text"),
                       
GetSQLValueString($_POST['empresa'], "text"),
                       
GetSQLValueString($_POST['dir_empresa'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa'], "text"),
                       
GetSQLValueString($_POST['jefe'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe'], "text"),
                       
GetSQLValueString($_POST['terminacion'], "text"),
                       
GetSQLValueString($_POST['sueldo_final'], "text"),
                       
GetSQLValueString($_POST['desde2'], "text"),
                       
GetSQLValueString($_POST['hasta2'], "text"),
                       
GetSQLValueString($_POST['empresa2'], "text"),
                       
GetSQLValueString($_POST['dir_empresa2'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa2'], "text"),
                       
GetSQLValueString($_POST['jefe2'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe2'], "text"),
                       
GetSQLValueString($_POST['terminacion2'], "text"),
                       
GetSQLValueString($_POST['sueldo_final2'], "text"),
                       
GetSQLValueString($_POST['desde3'], "text"),
                       
GetSQLValueString($_POST['hasta3'], "text"),
                       
GetSQLValueString($_POST['empresa3'], "text"),
                       
GetSQLValueString($_POST['dir_empresa3'], "text"),
                       
GetSQLValueString($_POST['cargo_empresa3'], "text"),
                       
GetSQLValueString($_POST['jefe3'], "text"),
                       
GetSQLValueString($_POST['cargo_jefe3'], "text"),
                       
GetSQLValueString($_POST['terminacion3'], "text"),
                       
GetSQLValueString($_POST['sueldo_final3'], "text"),
                       
GetSQLValueString($_POST['instituto'], "text"),
                       
GetSQLValueString($_POST['dir_instituto'], "text"),
continua
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #2 (permalink)  
Antiguo 16/06/2008, 14:00
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Cannot modify header information

Código PHP:
GetSQLValueString($_POST['anos_cur'], "text"),
                       
GetSQLValueString($_POST['inicio_inst'], "text"),
                       
GetSQLValueString($_POST['final_inst'], "text"),
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['instituto2'], "text"),
                       
GetSQLValueString($_POST['dir_instituto2'], "text"),
                       
GetSQLValueString($_POST['anos_cur2'], "text"),
                       
GetSQLValueString($_POST['inicio_inst2'], "text"),
                       
GetSQLValueString($_POST['final_inst2'], "text"),
                       
GetSQLValueString($_POST['titulo2'], "text"),
                       
GetSQLValueString($_POST['instituto3'], "text"),
                       
GetSQLValueString($_POST['dir_instituto3'], "text"),
                       
GetSQLValueString($_POST['anos_cur3'], "text"),
                       
GetSQLValueString($_POST['inicio_cur3'], "text"),
                       
GetSQLValueString($_POST['final_cur3'], "text"),
                       
GetSQLValueString($_POST['titulo3'], "text"),
                       
GetSQLValueString($_POST['instituto4'], "text"),
                       
GetSQLValueString($_POST['dir_instituto4'], "text"),
                       
GetSQLValueString($_POST['anos_cur4'], "text"),
                       
GetSQLValueString($_POST['inicio_inst4'], "text"),
                       
GetSQLValueString($_POST['final_inst4'], "text"),
                       
GetSQLValueString($_POST['titulo4'], "text"),
                       
GetSQLValueString($_POST['instituto5'], "text"),
                       
GetSQLValueString($_POST['dir_instituto5'], "text"),
                       
GetSQLValueString($_POST['anos_cur5'], "text"),
                       
GetSQLValueString($_POST['inicio_inst5'], "text"),
                       
GetSQLValueString($_POST['final_inst5'], "text"),
                       
GetSQLValueString($_POST['titulo5'], "text"),
                       
GetSQLValueString($_POST['nomape'], "text"),
                       
GetSQLValueString($_POST['direccion_ref'], "text"),
                       
GetSQLValueString($_POST['tel_ref'], "text"),
                       
GetSQLValueString($_POST['tiempo_ref'], "text"),
                       
GetSQLValueString($_POST['nomape2'], "text"),
                       
GetSQLValueString($_POST['direccion_ref2'], "text"),
                       
GetSQLValueString($_POST['tel_ref2'], "text"),
                       
GetSQLValueString($_POST['tiempo_ref2'], "text"),
                       
GetSQLValueString($_POST['povehiculo'], "text"),
                       
GetSQLValueString($_POST['modelovehi'], "text"),
                       
GetSQLValueString($_POST['anovehi'], "text"),
                       
GetSQLValueString($_POST['licenpos'], "text"),
                       
GetSQLValueString($_POST['licengrado'], "text"));

  
mysql_select_db($database_pintor$pintor);
  
$Result1 mysql_query($insertSQL$pintor) or die(mysql_error());


  
$insertGoTo "gr_unete.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
function 
generaSubcategoria()
{
    include 
'conexion.php';
    
conectar();
    
$consulta=mysql_query("SELECT id, nombre FROM cargo");
    
desconectar();

    
// Voy imprimiendo el primer select compuesto por los paises
    
echo "<select name='cargo' id='cargo' onChange='cargaContenido(this.id)'>";
    echo 
"<option value='0'>Elige</option>";
    while(
$registro=mysql_fetch_row($consulta))
    {
        echo 
"<option value='".$registro[0]."'>".$registro[1]."</option>";
    }
    echo 
"</select>";
}

mysql_select_db($database_pintor$pintor);
$query_Recordset1 "SELECT * FROM puesto";
$Recordset1 mysql_query($query_Recordset1$pintor) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?> 
Gracias :(
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #3 (permalink)  
Antiguo 16/06/2008, 14:05
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Cannot modify header information

y que hay en la linea 15 de unete.php??


Warning: Cannot modify header information - headers already sent by (output started at /home/indexa/public_html/latiendadelpintor/unete.php:15) in /home/indexa/public_html/latiendadelpintor/ficha_empleos.php on line 151
  #4 (permalink)  
Antiguo 16/06/2008, 14:06
Avatar de Nano_  
Fecha de Ingreso: febrero-2006
Ubicación: Bogotá, Colombia
Mensajes: 1.866
Antigüedad: 18 años, 2 meses
Puntos: 96
Mensaje Respuesta: Cannot modify header information

Saludos..

Debes verificar que no halla una salida antes de la funcion header al explorador ya sea un echo por ejemplo.

Hasta Pronto!!
__________________
:.:Nano.:: @nano_hard - Retornando al foro
  #5 (permalink)  
Antiguo 16/06/2008, 14:07
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Cannot modify header information

esto

<title>..// L A T I E N D A D E L P I N T O R //..</title>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #6 (permalink)  
Antiguo 16/06/2008, 14:13
Avatar de jaronu  
Fecha de Ingreso: febrero-2008
Mensajes: 2.183
Antigüedad: 16 años, 2 meses
Puntos: 52
Respuesta: Cannot modify header information

pues ese es el problema, te lo dijo el nano_
  #7 (permalink)  
Antiguo 16/06/2008, 14:14
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Cannot modify header information

jeje cual??? el titulo?
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #8 (permalink)  
Antiguo 16/06/2008, 14:14
Avatar de Nano_  
Fecha de Ingreso: febrero-2006
Ubicación: Bogotá, Colombia
Mensajes: 1.866
Antigüedad: 18 años, 2 meses
Puntos: 96
Respuesta: Cannot modify header information

Cita:
Iniciado por Nano_ Ver Mensaje
Saludos..

Debes verificar que no halla una salida antes de la funcion header al explorador ya sea un echo por ejemplo.

Hasta Pronto!!
Etiquetas HTML tampoco debes colocar antes del header ya que esas son salidas al explorador tambien!!.

Hasta Pronto
__________________
:.:Nano.:: @nano_hard - Retornando al foro
  #9 (permalink)  
Antiguo 16/06/2008, 14:26
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Cannot modify header information

pero primera vez q me ocurre esto con un form... y el form esta en un include q es ficha_empleos.php

tambien afecta??? algun link para leer el por q?
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #10 (permalink)  
Antiguo 16/06/2008, 14:26
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Cannot modify header information

Revisa esta FAQ: http://www.forosdelweb.com/2037876-post179.html

Saludos,.
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 13:15.