Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/08/2008, 18:16
brack
 
Fecha de Ingreso: agosto-2008
Mensajes: 2
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Re: Cerrar la ventana del formulario y automaticamente abrir otra con el m

Cita:
Iniciado por elgame Ver Mensaje
lo puedes hacer con js o puedes utilizar header en php solo que el header lo cargaria en la misma pagina pero te quitaria el formulario.
Hola yo lo hago de la siguiente manera! (te pongo el codigo completo de mi pagina)

formu.htm
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
 <form action="envio.php" onSubmit="return Verificar()" METHOD="GET" name="frm" id="frm">
      <center>
        <table border="0" width="37%" id="table246" cellspacing="0" cellpadding="0" style="border-width: 0">
          <tr>
            <td height="49" colspan="2"><p class="Estilo9" style="margin-top: 0; margin-bottom: 5px">&nbsp;</p>            </td>
          </tr>
          <tr>
            <td width="53%"><p class="Estilo9" style="margin-top: 0; margin-bottom: 5px">Nombre:</p>
                <p style="margin-top: 5px; margin-bottom: 5px">
                  <input name="nombre" type="text" class="formtexto" size="33">
              </p></td>
            <td width="47%">&nbsp;</td>
          </tr>
          <tr>
            <td><p class="Estilo9" style="margin-top: 0; margin-bottom: 5px">:direccion</p>
                <p style="margin-top: 5px; margin-bottom: 5px">
                  <input NAME="direccion" TYPE="text" class="formtexto" SIZE="33">
              </p></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2"><p class="Estilo9" style="margin-top: 0; margin-bottom: 5px">Mensaje:</p>
                <p style="margin-top: 5px; margin-bottom: 5px">
                  <textarea name="comentarios" cols="25" rows="7" class="formtexto"> </textarea>
              </p></td>
          </tr>
        </table>
      </center>
      <table width="446" border="0" align="center">
        <tr>
          <td width="77"><input type="submit" class="formtexto" value="ENVIAR" onclick='window.print();'></td>
          <td width="392"><input type="reset" class="formtexto" value="Limpiar"></td>
		  <td width="392"> <input type="imprimi" name='boton' value='Imprimir' onclick='window.print();'></td>
		 
        </tr>
   </table>
</form>

</body>
</html>
envio.php
Código PHP:
<? 
/* aqui se incializan variables de PHP */ 
if (phpversion() >= "4.2.0") { 
if ( 
ini_get('register_globals') != ) { 
$supers = array('_REQUEST'
'_ENV'
'_SERVER'
'_POST'
'_GET'
'_COOKIE'
'_SESSION'
'_FILES'
'_GLOBALS' ); 

foreach( 
$supers as $__s) { 
if ( (isset($
$__s) == true) && (is_array( $$__s 
) == true) ) extract( $$__sEXTR_OVERWRITE ); 

unset(
$supers); 

} else { 
if ( 
ini_get('register_globals') != ) { 

$supers = array('HTTP_POST_VARS'
'HTTP_GET_VARS'
'HTTP_COOKIE_VARS'
'GLOBALS'
'HTTP_SESSION_VARS'
'HTTP_SERVER_VARS'
'HTTP_ENV_VARS' 
); 

foreach( 
$supers as $__s) { 
if ( (isset($
$__s) == true) && (is_array( $$__s 
) == true) ) extract( $$__sEXTR_OVERWRITE ); 

unset(
$supers); 



/* DE AQUI EN ADELANTE PUEDES EDITAR EL ARCHIVO */ 

if($nombre==""

/* reclama si no se ha rellenado el campo email en el formulario */ 
echo "No ingresastetu nombre"
exit(); 


/* aquí se especifica la pagina de respuesta en caso de envío exitoso */ 
$respuesta="respuesta1.htm"
// la respuesta puede ser otro archivo, en incluso estar en otro servidor 

/* AQUÍ ESPECIFICAS EL CORREO AL CUAL QUEREIS QUE SE ENVÍEN LOS DATOS 
DEL FORMULARIO, SI QUIERES ENVIAR LOS DATOS A MÁS DE UN CORREO, 
LOS PUEDES SEPARAR POR COMAS */ 
$para ="[email protected]"

/* AQUI ESPECIFICAS EL SUJETO DEL EMAIL */ 
$sujeto "Multimedia Plus"

/* aquí se construye el encabezado del correo*/ 
$encabezado "From: $nombre <$email>"
$encabezado .= "\nReply-To: $email"
$encabezado .= "\nX-Mailer: PHP/" phpversion(); 

/* con esto se captura la IP del que envío el mensaje */ 
$ip=$REMOTE_ADDR

/* las siguientes líneas arman el mensaje */ 
$mensaje .= "NOMBRE = $nombre\n"
$mensaje .= "direccion = $direccion\n"
$mensaje .= "COMENTARIOS = $comentarios\n"
$mensaje .= "TU DIRECCION IP = $ip\n"

/* aqui se intenta enviar el correo, si no se 
tiene éxito se da un mensaje de error */ 
if(!mail($para$sujeto$mensaje$encabezado)) 

echo 
"<h1>No se pudo enviar el Mensaje</h1>"
exit(); 

else 

/* aqui redireccionamos a la pagina de respuesta */ 
echo "<meta HTTP-EQUIV='refresh' content='1;url=$respuesta'>"


?>
si qieres le qitas el boton de imprimir!

saludos