Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/12/2009, 10:53
gigigil
 
Fecha de Ingreso: diciembre-2009
Mensajes: 5
Antigüedad: 15 años, 3 meses
Puntos: 0
Ayuda con un formulario php

Buenas tardes:

He creado un formulario que llega correctamente, pero me gustaría que las " Gracias por enviar el formulario" las diese en una pagina que se llama gracias.html.

he utilizado para ello: header( 'Location: http://www.SuSitio.com/gracias.html' ) pero no soy capaza de hacerlo funcionar. me da un warning.


Os agradezco la ayuda. Os dejo el código completo.

<!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>Formulario de Petición de Información</title>
<script language="javascript">
function marcado(){
if (document.form.termin.checked) {

}
else{
alert("Debes aceptar los términos y condiciones");
document.form.termin.focus();
return false;
}

}
</script>

<?
if (!$HTTP_POST_VARS){
?> </p>
<style type="text/css">
<!--
.Estilo15 {color: #999999}
.Estilo19 { color: #000000
}
-->
</style>
<form action="envia_form_php.php" method=post name="form" onsubmit="return marcado();"><div align="center">
<table width="500" border="0" align="left" cellpadding="2" cellspacing="2">
<tr>
<td><div align="right">Nombre: </div></td>
<td><input type="text" name="nombre2" size="30" /></td>
</tr>
<tr>
<td><div align="right">Apellidos: </div></td>
<td><input type="text" name="apellidos" size="30" /></td>
</tr>
<tr>
<td><div align="right">Email:</div></td>
<td><input type="text" name="email" size="30" /></td>
</tr>
<tr>
<td><div align="right">Provincia: </div></td>
<td><input type="text" name="provincia" size="30" /></td>
</tr>
<tr>
<td><div align="right">Tel&eacute;fono: </div></td>
<td><input type="text" name="Tel&eacute;fono" size="30" /></td>
</tr>
<tr>
<td valign="top"><div align="right">Consulta:</div></td>
<td><textarea name="coment" cols="32" rows="6"></textarea></td>
</tr>
<tr>
<td colspan="2" valign="top"><div align="left" class="Estilo19">
<input type="checkbox" value="1" name="termin" id="termin" />
<span class="Estilo15">He le&iacute;do y acepto las condiciones. <a href="aviso-legal.html" target="_blank">Aviso Legal</a> y <a href="politica-de-privacidad.html">Pol&iacute;itica de Privacidad</a></span></div></td>
</tr>
<tr>
<td valign="top"><label>
<input type="submit" name="Enviar" value="Enviar" />
</label></td>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table>
<br>
</div>
</form>
<?

}else{
//Estoy recibiendo el formulario, compongo el cuerpo
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$cuerpo = "Formulario enviado por:\n";
$cuerpo .= "Nombre: " . $HTTP_POST_VARS["nombre"] . "\n";
$cuerpo .= "Email: " . $HTTP_POST_VARS["email"] . "\n";
$cuerpo .= "Provincia: " . $HTTP_POST_VARS["nombre"] . "\n";
$cuerpo .= "Teléfono: " . $HTTP_POST_VARS["email"] . "\n";
$cuerpo .= "Comentarios: " . $HTTP_POST_VARS["coment"] . "\n";
$cuerpo .= "Consulta: " . $HTTP_POST_VARS["coment"] . "\n";

//mando el correo...
mail("[email protected]","Petición de Información;",$cuerpo);

//doy las gracias por el envío
header( 'Location: http://www.SuSitio.com/gracias.html' )
;
}
?>