Foros del Web » Programando para Internet » PHP »

problema con redireccion (sintaxis)

Estas en el tema de problema con redireccion (sintaxis) en el foro de PHP en Foros del Web. Hola lo que queria yo era una redirección a eleccion del usuario en php había generado este código pero no se donde esta el fallo ...
  #1 (permalink)  
Antiguo 15/05/2010, 13:34
 
Fecha de Ingreso: noviembre-2008
Mensajes: 20
Antigüedad: 15 años, 5 meses
Puntos: 0
Pregunta problema con redireccion (sintaxis)

Hola lo que queria yo era una redirección a eleccion del usuario en php había generado este código pero no se donde esta el fallo

Código PHP:
<!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 action="Untitled-9.php" method="post" id=”formulario”>
Link: <input type="text" name="link" id="link" />
<
input type="submit" value="Redirigir" name="Redirigir" id="Redirigir" />
</
body>
</
html
ESTA LA PAG DEL EL LINK QUE QUIERAS Y MEDIANTE EL METODO POST ME LO ENVIABA A ESTA PAGINA

Código PHP:
<!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>
<? 
$_GET
['link']= "$link"
header(localitation$link); 

 
exit;  
?> 


</body>
</html>
Pero al subirlo a mi web me da este error :

syntax error, unexpected T_STRING on line 11

¿Donde está el fallo?
  #2 (permalink)  
Antiguo 17/05/2010, 08:30
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Tema movido desde Configuración PHP a PHP
  #3 (permalink)  
Antiguo 17/05/2010, 09:11
 
Fecha de Ingreso: abril-2009
Ubicación: Incomoda
Mensajes: 30
Antigüedad: 15 años
Puntos: 0
Respuesta: problema con redireccion (sintaxis)

$_GET['link']= "$link"
header(localitation: $link);

No se si sea este el problema, pero... en vez de $_GET['link']= "$link" deberia ser alrevez:
$link = $_GET['link'];
  #4 (permalink)  
Antiguo 17/05/2010, 09:16
Avatar de quike88  
Fecha de Ingreso: agosto-2008
Mensajes: 471
Antigüedad: 15 años, 7 meses
Puntos: 87
Respuesta: problema con redireccion (sintaxis)

El formulario lo envias por POST, osea q tendria que ser:

$link = $_POST["link"];
header("location: $link");

Etiquetas: código., sintaxis, redireccionar
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 21:18.