Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/03/2009, 16:13
worldPeace_Plis
Usuario no validado
 
Fecha de Ingreso: marzo-2007
Mensajes: 238
Antigüedad: 17 años, 2 meses
Puntos: 5
ya valide, y ahora como mando datos de form?

Hola, me ando armando este form en una ventana modal:

Código HTML:
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<form name="myform">
<!--  method="post" action="contar.php" -->
  <tr>
    <td>Nombre:</td>
    <td>&nbsp;<input type="text" id="namefield"  name="namefield" size="30"></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td>&nbsp;<input id="emailfield" type="text" name="emailfield" size="30" /></td>
  </tr>
  <tr>
    <td>Telefono:</td>
    <td>&nbsp;<input type="text" name="telfield" id="telfield" size="30"></td>
  </tr>
  <tr>
    <td>Comentario:</td>
    <td>&nbsp;<textarea id="comments" name="comments" rows="5" cols="26" ></textarea></td>
  </tr>

<tr><td colspan="2" align="center"><input type="reset" value="Restablecer" name="B2">&nbsp;&nbsp;&nbsp;
<input type="submit" value="Enviar" name="B1"onClick="parent.emailwindow.hide()" >
</td></tr>
</form>
</table> 
bueno la cosa es que ya despues de validar campos: email, nombre y mensaje con js
Código HTML:
<script type="text/javascript">
function emailform(){
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'modalfiles/emailform.html', 'Contact email form page', 'width=370px,height=450px,center=1,resize=0,scrolling=0')

emailwindow.onclose=function(){
	var theform=this.contentDoc.forms[0]
	var theemail=this.contentDoc.getElementById("emailfield")
	var thename=this.contentDoc.getElementById("namefield")
	var thecomments=this.contentDoc.getElementById("comments")
	
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
	var returnval=emailfilter.test(theemail.value)
	
	
	if (thename.value.length==0){
		alert("Por favor escribe tu nombre")
		thename.select()
		return false
	} else if (returnval==false){ 
		alert("E-mail invalido")
		theemail.select()
		return false
	} else if (thecomments.value.length==0){ 
		alert("Deja tu comentario")
		thecomments.select()
		return false
	}
	else{ // this is a valid email
		document.getElementById("youremail").innerHTML='Gracias '+thename.value+', pronto estaremos en contacto en '+theemail.value
		return true; // allow closing of window
	}
}
}
</script> 
no se que sigue, como envio por post los datos a envio.php
Código PHP:
if (isset($_POST['submit'])) {
// We get all the variables
foreach ($_POST as $key=>$value) {
if ( 
gettype$value ) == "array" ) {
//print "$key == <br>\n";
     
} else {         
//print "$key == $value<br>\n";
$key $value;
}
}
 
$message "FORMULARIO DE CONTACTO\n" 
"\nNombre: " $nombre 
"\nEmail: " $mail 
"\ndireccion: " $direccion .
 
 
$to 'alguien@my_mail.com';
$subject 'Formulario de contacto';
$headers "From: Somebody\r\n";
 
mail($to,$subject,$message,$headers);
 
header('Location: gracias.htm'); // Esta linea redirije a otra pagina...la podes sacar
 
} else {
echo 
'ERROR! de acceso.';


Desde el js, cuando return = true: Que sigue? como lo mando?