Foros del Web » Programando para Internet » PHP »

Problema De Redireccionamiento...

Estas en el tema de Problema De Redireccionamiento... en el foro de PHP en Foros del Web. Mis estimados: Tengo un problema, He creado una pagina con un formulario de comentarios muy sencillo y resulta que cuando quiero probarlo me arroja el ...
  #1 (permalink)  
Antiguo 06/10/2007, 21:32
 
Fecha de Ingreso: octubre-2006
Mensajes: 5
Antigüedad: 17 años, 6 meses
Puntos: 0
Problema De Redireccionamiento...

Mis estimados:

Tengo un problema,

He creado una pagina con un formulario de comentarios muy sencillo y resulta que cuando quiero probarlo me arroja el siguente error:

Warning: Cannot modify header information - headers already sent by (output started at /home/zeopccl/public_html/chilewarez/index.php:7) in /home/zeopccl/public_html/chilewarez/comentario.php on line 46

Les dejo el codigo para que lo revisen haber si alguien me puede ayudar.

Código PHP:
<?php require_once('Connections/ChileWarezcl.php'); ?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 contacto (usuarioWarez, comentario) VALUES (%s, %s)",
                       
GetSQLValueString($_POST['usuarioWarez'], "text"),
                       
GetSQLValueString($_POST['comentario'], "text"));

  
mysql_select_db($database_ChileWarezcl$ChileWarezcl);
  
$Result1 mysql_query($insertSQL$ChileWarezcl) or die(mysql_error());

  
$insertGoTo "index.php?id=gracias";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction?>">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">UsuarioWarez:</td>
      <td><input type="text" name="usuarioWarez" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td height="107" align="left" valign="middle" nowrap>Comentario:</td>
      <td><textarea name="comentario" cols="32" rows="7"></textarea></td>
    </tr>
    <tr valign="baseline">
      <td nowrap 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>
</body>
</html>
Cabe señalar que esto lo estoy trabajando con DreamWeaver. por si sirve esa info.

Espero sus comentarios y ayudas.

atte

Neo
  #2 (permalink)  
Antiguo 06/10/2007, 22:45
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Re: Problema De Redireccionamiento...

aqui
header(sprintf("Location: %s", $insertGoTo));

no puedes hacer un sprintf del header ? por que ya tienes salidas anteriores, recuerda que un header es lo primero que se envia...
lo mas seguro que tengas conflictos con
require_once('Connections/ChileWarezcl.php');
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #3 (permalink)  
Antiguo 07/10/2007, 08:48
 
Fecha de Ingreso: octubre-2006
Mensajes: 5
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Problema De Redireccionamiento...

Cita:
Iniciado por kaninox Ver Mensaje
aqui
header(sprintf("Location: %s", $insertGoTo));

no puedes hacer un sprintf del header ? por que ya tienes salidas anteriores, recuerda que un header es lo primero que se envia...
lo mas seguro que tengas conflictos con
require_once('Connections/ChileWarezcl.php');
Lo raro esque envia el formulario pero no redirecciona la pagina... ahora no entiendo porque el dreamweaver no lo soluciona... ya que antes nunca habia tenido problemas.

Entonces que me recomiendas???? Que cambio le hago al codigo???

Me po lodrias colocar???

Gracias
  #4 (permalink)  
Antiguo 07/10/2007, 10:46
 
Fecha de Ingreso: julio-2006
Mensajes: 96
Antigüedad: 17 años, 9 meses
Puntos: 2
Re: Problema De Redireccionamiento...

Cita:
Iniciado por Neo007 Ver Mensaje
Lo raro esque envia el formulario pero no redirecciona la pagina... ahora no entiendo porque el dreamweaver no lo soluciona... ya que antes nunca habia tenido problemas.

Entonces que me recomiendas???? Que cambio le hago al codigo???

Me po lodrias colocar???

Gracias
Hola , si pones el codigo de chilewarezcl.php para que lo veamos seria mas facil poder ayudarte de todas formas el error que presentas el tipico cuando usas cabeceras , una regla basica de ellas es que no pueden enviar ningun tipo de dato antes que un header(); ,por lo tanto en tu script puedes tener quizas un espacio en blanco , un error del include ,un header que no veas , un echo , o algun tipo de envio de informacion al navegador , revisa esto y vuelve a intentarlo.

PD:Ya se trato este tema en un post de una antiguedad no maxima a 1 semana utiliza el buscador
  #5 (permalink)  
Antiguo 07/10/2007, 19:42
 
Fecha de Ingreso: octubre-2006
Mensajes: 5
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Problema De Redireccionamiento...

Cita:
Iniciado por jonatanlc Ver Mensaje
Hola , si pones el codigo de chilewarezcl.php para que lo veamos seria mas facil poder ayudarte de todas formas el error que presentas el tipico cuando usas cabeceras , una regla basica de ellas es que no pueden enviar ningun tipo de dato antes que un header(); ,por lo tanto en tu script puedes tener quizas un espacio en blanco , un error del include ,un header que no veas , un echo , o algun tipo de envio de informacion al navegador , revisa esto y vuelve a intentarlo.

PD:Ya se trato este tema en un post de una antiguedad no maxima a 1 semana utiliza el buscador

Te refieres a que postee el codigo del Index o el del Registro??? porque ese ya esta posteado arriba...

Avisame porfa...
  #6 (permalink)  
Antiguo 07/10/2007, 23:51
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Re: Problema De Redireccionamiento...

te esta pidiendo lo que tienes aqui
<?php require_once('Connections/ChileWarezcl.php'); ?>
en ChileWarezcl.php
debe tener algun echo u otra salida header, o bien tu dreamweber se peto y empieza por la linea 2 que ya me ha pasado :o ojo y he estado dias y dias en darme cuenta X)....
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #7 (permalink)  
Antiguo 08/10/2007, 02:55
 
Fecha de Ingreso: octubre-2004
Mensajes: 2.627
Antigüedad: 19 años, 5 meses
Puntos: 48
Re: Problema De Redireccionamiento...

Cita:
Warning: Cannot modify header information - headers already sent by (output started at /home/zeopccl/public_html/chilewarez/index.php:7) in /home/zeopccl/public_html/chilewarez/comentario.php on line 46
El error te dice que sacas salida en la linea 7 de index.php. No se, pero como errores tontos se me ocurren 2:

1.- que haya caracteres en blanco detras del ?> de Connections/ChileWarezcl.php

2.- o que que este tomando como salida el salto de linea entre estas 2 lineas
<?php require_once('Connections/ChileWarezcl.php'); ?>
<?php

Apuesto por la 2.
  #8 (permalink)  
Antiguo 08/10/2007, 03:13
 
Fecha de Ingreso: marzo-2005
Ubicación: Sevilla
Mensajes: 277
Antigüedad: 19 años, 1 mes
Puntos: 2
Re: Problema De Redireccionamiento...

bueno todo es ir probando. de momento deberias cambiar

Código:
<?php require_once('Connections/ChileWarezcl.php'); ?> 
<?php 
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")  
{ 
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; 

..........

por eto otro:

Código:
<?php require_once('Connections/ChileWarezcl.php');
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")  
{ 
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
y por supueto asegurate que delante del <? no haya espacios.
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 01:15.