Ver Mensaje Individual
  #7 (permalink)  
Antiguo 04/02/2011, 09:43
lockalt
 
Fecha de Ingreso: febrero-2011
Mensajes: 18
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Formulario PHP abrir ventana "echo "<SCRIPT>window.open"

Tampoco me funciona.

De todas maneras muchas gracias, por vuestro tiempo.

He buscado otra solución que funciona aunque creo que es un poco una chapuza XD

Utilizando javascript para comprobar datos y abrir el pop-up y el PHP para enviarlo.

La inserto por si alguien le puede ser de ayuda. O por si teneis una solución mejor

Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Documento sin título</title>
<script type="text/javascript">
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
</script>
<script language="javascript"> 
function ventanaSecundaria (URL){ 
window.open(URL,"ventana1","width=900,height=500,s crollbars=NO") 
} 
</script>
</head>

<body>
<form action="enviar.php" method="post" enctype="multipart/form-data" onsubmit="ventanaSecundaria('http://www.google.com')" name="form" id="form" >
	<input type="hidden" name="nombre" id="name" value="Mensaje desde la web" />
	<label class="texte">NAME </label>
	  <input  name="nombre" type="text" class="imput1" id="nombre" value="" /><br />
	<label class="texte">MAIL </label>
	  <input name="mail" type="text" class="imput1" id="mail" value="" /><br />
	<label class="texte">MESSAGE </label>
    <textarea name="mensaje" class="imput2" id="mensaje"></textarea>
    <br />
<input name="Enviar" type="submit" id="enviar" onClick="MM_validateForm('nombre','','R','mail','','RisEmail','mensaje','','R');return document.MM_returnValue" value="Enviar" />
</form>
</body>
</html> 
Código PHP:
<?php
$nombre 
$_POST['nombre'];
$apellidos $_POST['mail'];
$mail $_POST['mensaje'];


$header 'From: ' $mail " \r\n";
$header .= "X-Mailer: PHP/" phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";

$mensaje "Este mensaje fue enviado por " $nombre " \r\n";
$mensaje .= "Su e-mail es: " $mail " \r\n";
$mensaje .= "Mensaje: " $mensaje .  " \r\n";

$mensaje .= "Enviado el " date('d/m/Y'time());

$para '[email protected]';
$asunto 'Message from web';

mail($para$asuntoutf8_decode($mensaje), $header);

echo 
"<SCRIPT>history.back(1)</SCRIPT>"

?>