Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/03/2008, 04:02
chefnelone
 
Fecha de Ingreso: diciembre-2005
Ubicación: Barcelona
Mensajes: 1.428
Antigüedad: 18 años, 4 meses
Puntos: 15
Enviar formulario con php? sin abrir ventana nueva

Hola

Estoy modificando un script que tengo para enviar un form desde flash usando contact.php.

Todo funciona bien pero cuando hace el envío, se abre en una nueva ventana

Me gustaria que no se abra ninguna ventana y que un mensaje ("su mensaje ha sido enviado") aparezca en flash (podría ser en un campo de texto dinámico que tome una variable que le envíe contact.php)

Es posible?

aquí dejo todos los codigo:

en flash: el actionscript en la linea de tiempo donde están los campos del formulario

Código:
rec="[email protected]";
serv="php";

var fields_descriptions= Array ("", 
									Array("t1", "your_name", "Su Nombre:"), 
									Array("t2", "your_email", "Su Email:"),
									Array("t3", "telephone", "Su Telefono:"),
									Array("t4", "message", "El Mensaje:"),
									Array("t5", "field_2", "Su E-mail:"),
									Array("t6", "field_3", "Su Direccion"),
									Array("t7", "field_4", "Su Fax:")
								);

function reset_txt(name,name2,value) {
		path=eval(_target);
		path[name2]=value;
	
	this[name].onSetFocus=function() {
		path=eval(_target);
		if(path[name2]==value) { path[name2]="";} 
	}
	
	this[name].onKillFocus=function() {
		path=eval(_target);
		if(path[name2]=="") { path[name2]=value;} 
	}
}


for (i=1; i<=fields_descriptions.length; i++) {
	reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}
en flash: El codigo que tiene el botón enviar del formulario
Código:
on (release) {
	for (i=1; i<_parent.fields_descriptions.length; i++) {
		if (_parent[_parent.fields_descriptions[i][1]]!=_parent.fields_descriptions[i][2]) {
			this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2];
		}
		_parent.reset_txt(_parent["t"+i], _parent.fields_descriptions[i][1], _parent.fields_descriptions[i][2]);
	}

	this.recipient=_parent.rec;
	delete(i);
	getURL("contact."+_parent.serv, "_blank", "POST");
	
}
contact.php

Código:
<?php
Error_Reporting(E_ALL & ~E_NOTICE);

 while ($request = current($_REQUEST)) {
 	if (key($_REQUEST)!='recipient') {
		$pre_array=split ("&777&",  $request);
		
		$post_vars[key($_REQUEST)][0]=preg_replace ("/<[^>]*>/", "", $pre_array[0]);
		$post_vars[key($_REQUEST)][1]=preg_replace ("/<[^>]*>/", "", $pre_array[1]);
	}
	next($_REQUEST);
}



reset($post_vars);


$subject="From ".$post_vars['your_name'][0] ;
$headers= "From: ".$post_vars['your_email'][0] ."n";
 $headers.='Content-type: text/html; charset=iso-8859-1';
 $message='';
  while ($mess = current($post_vars)) {
  	if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {

	 	$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
	}
	next($post_vars);
 }

mail($_REQUEST['recipient'], $subject,  "
<html>
<head>
 <title>Contact letter</title>
</head>
<body>
<br>
  ".$message."
</body>
</html>" , $headers);


?>
muchas gracias