Problema con el header();

Yo tengo dos archivos con extensión .php el primero que no te lo envíe es un formulario que tiene una conexión a este a través del method = post . El problema es que el headers me da un error y no hallo como corregirlo... Ya le quite los espacios como puedes verlo. Este código que te envío esta en un segundo documento, son dos.
<!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=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<?php
include("funcion.php");
$link=conexion();
$nombre=$_POST["nombre"];$direccion=$_POST["direccion"];$telefono=$_POST["telefono"];
$email=$_POST["email"];$imagen=$_POST["imagen"];
$sql="insert into tablacurso(nombre,direccion,telefono,email,imagen)values('$nombre','$direccion','$telefono','$email','$imagen')";
mysql_query($sql,$link);
header("Location: insertareg.php");  //aca esta el problema...
?>
</body>
</html>

1 respuesta

Respuesta
1
Ok, todo este código, el que pertenece a HTML, ponlo debajo del header. Para que el header funcione no se debe de sacar nada de HTML por pantalla hasta después, ¿ok?:
<!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=utf-8" />
<title>Documento sin título</title>
</head>
<body>
Amigo lo coloque como tu me dijiste... el problema sigue... de verdad lo he intentado todo... espero me ayudes...
<?php
include("funcion.php");
$link=conexion();
$nombre=$_POST["nombre"];$direccion=$_POST["direccion"];$telefono=$_POST["telefono"];
$email=$_POST["email"];$imagen=$_POST["imagen"];
$sql="insert into tablacurso
(nombre,direccion,telefono,email,imagen)values
('$nombre','$direccion','$telefono','$email','$imagen')";
mysql_query($sql,$link);
header("Location: insertareg.php=go");
?>
<!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=utf-8" />
<title>Documento sin título</title>
</head>
<body>
</body>
</html>
Revisa que en function.php no hay ningún espacio HTML, que sea todo PHP, sino te saltará el error.
Jorge

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas