Comunidad de diseño web y desarrollo en internet online

Formulario en flash. Llega el mail pero vacío

Citar            
MensajeEscrito el 27 Feb 2009 02:27 am
Hola,

He hecho un formulario en flash. Este es el código que he metido en flash:

Código :

enviar = function () {
if (email_txt.text.length) {
if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {
form_lv = new LoadVars();
form_lv.mail = email_txt.text;
form_lv.sendAndLoad("send.php", form_lv, "POST");
servidor_txt.text = "Sending...";
email_txt.text = "";
form_lv.onLoad = function() {
if (this.estatus == "ok") {
servidor_txt.text = "The form was sent...";
email_txt.text = "";
} else {
servidor_txt.text = "Problems with the server.";
}
};
} else {
email_txt.text = "Invalid mail";
}
} else {
email_txt.text = "Write data";
}
};
borrar = function () {
email_txt.text ="";
};
enviar_btn.onRelease = enviar;
borrar_btn.onRelease = borrar;


Luego eso va a un archivo que llamo send.php con este código:

Código :

<? 

$email = $_POST['email'];


$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 .= "The e-mail is: " . $mail . " \r\n";
$mensaje .= "Notes: " . $_POST['mensaje'] . " \r\n";
$mensaje .= "Sent in " . date('d/m/Y', time());

$para = '[email protected]';
$asunto = 'Contact form';

mail($para, $asunto, utf8_decode($mensaje), $header);

echo '&estatus=ok&';
?>


El caso es que funciona, el mail me llega y tal pero no los datos. Es algo muy sencillo, lo sé, pero no soy programador y estoy perdido... Algún consejo?? Tiene que haber algún error al recoger o mandar los datos o algo... Help please...

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 27 Feb 2009 07:49 am
Hola, llega vacio completamente, o llega esto:

The e-mail is: [email protected]
Notes:
Sent in 8/8/8

Cuando envias los datos, no envias ningun mensaje:

Código ActionScript :

form_lv = new LoadVars();
form_lv.mail = email_txt.text;
form_lv.mensaje = "AQUI DEBERIA IR EL MENSAJE".
form_lv.sendAndLoad("send.php", form_lv, "POST");


Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 27 Feb 2009 01:35 pm
Hola. Llega esto:

The e-mail is:
Notes:
Sent in 8/8/8

Pero no llega el email. Tengo que cambiar el php o el flash? Gracias tío...

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 27 Feb 2009 03:27 pm
Pues esta bien ya que no le mandas nada a la variable que recibe el php en $_POST['mensaje'], de echo la primera linea de mensaje no debe llevar punto ya que esta comenzando la variable. y el mail te falto agregarle el $_POST

Código PHP :

$mensaje = "The e-mail is: " . $_POST['mail'] . " \r\n";
$mensaje .= "Notes: " . $_POST['mensaje'] . " \r\n";
$mensaje .= "Sent in " . date('d/m/Y', time());

Por nasho

Claber

908 de clabLevel

1 tutorial

Genero:Masculino  

Web Developer

firefox
Citar            
MensajeEscrito el 28 Feb 2009 12:36 am
tienes que cambiar los dos, el flash y el php, el cambio en el php, te lo explico nasho, y el cambio del flash, aqui esta:

LongeVie escribió:


Código ActionScript :

form_lv = new LoadVars();
form_lv.mail = email_txt.text;
form_lv.mensaje = "AQUI DEBERIA IR EL MENSAJE".
form_lv.sendAndLoad("send.php", form_lv, "POST");


form_lv.mensaje = mensaje_txt.text;

Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 02 Mar 2009 04:24 pm
Vale, creo que no acabo de entender mi fallo. El formulario anterior ya funciona correctamente. Ahora, en la misma página tengo otro formulario. En el flash tengo esto:

Código :

enviar = function () {
if (email_txt.text.length && name_txt.length && address_txt.length && phone_txt.length && current_date_display_txt.length && appointment_txt.length && reason_txt.length) {
if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {
form_lv = new LoadVars();
form_lv.name = name_txt.text;
form_lv.email = email_txt.text;
form_lv.address = address_txt.text;
form_lv.phone = phone_txt.text;
form_lv.current_date_display = current_date_display_txt.text;
form_lv.appointment = appointment_txt.text;
form_lv.reason = reason_txt.text;
form_lv.mensaje = mensaje_txt.text;

form_lv.sendAndLoad("send2.php", form_lv, "POST");
servidor_txt.text = "Sending...";
name_txt.text = "";
email_txt.text = "";
address_txt.text = "";
phone_txt.text = "";
current_date_display_txt.text = "";
appointment_txt.text = "";
reason_txt.text = "";
form_lv.onLoad = function() {
if (this.estatus == "ok") {
servidor_txt.text = "The form was sent...";
name_txt.text = "";
email_txt.text = "";
address_txt.text = "";
phone_txt.text = "";
current_date_display_txt.text = "";
appointment_txt.text = "";
reason_txt.text = "";
} else {
servidor_txt.text = "Problems with the server.";
}
};
} else {
email_txt.text = "Invalid mail";
}
} else {
email_txt.text = "Write data";
name_txt.text = "Write data";
address_txt.text = "Write data";
phone_txt.text = "Write data";
current_date_display_txt.text = "Write data";
appointment_txt.text = "Write data";
reason_txt.text = "Write data";
}
};
borrar = function () {
name_txt.text ="";
address_txt.text ="";
email_txt.text ="";
phone_txt.text ="";
current_date_display_txt.text ="";
appointment_txt.text ="";
reason_txt.text ="";
};
enviar_btn.onRelease = enviar;
borrar_btn.onRelease = borrar;



Se envían 7 variables pero sólo me llega el mail :)

En el php tengo esto otro:

Código :

<? 

$name = $_POST['name'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$current_date_display = $_POST['current_date_display'];
$appointment = $_POST['appointment'];
$reason = $_POST['reason'];


$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 = "This email was sent for " . $nombre . ", with phone " . $empresa . " \r\n";
$mensaje = "The e-mail is: " . $_POST['mail'] . " \r\n";
$mensaje .= "The name is: " . $_POST['name'] . " \r\n";
$mensaje .= "The phone is: " . $_POST['phone'] . " \r\n";
$mensaje .= "The current_date_display is: " . $_POST['current_date_display'] . " \r\n";
$mensaje .= "The appointment is: " . $_POST['appointment'] . " \r\n";
$mensaje .= "The reason is: " . $_POST['reason'] . " \r\n";
$mensaje .= "The name is: " . $_POST['name'] . " \r\n";
$mensaje .= "Notes: " . $_POST['mensaje'] . " \r\n";
$mensaje .= "Sent in " . date('d/m/Y', time());

$para = '[email protected]';
$asunto = 'Contact form';

mail($para, $asunto, utf8_decode($mensaje), $header);

echo '&estatus=ok&';
?>


Creo que el problema es el mismo que el anterior pero no llego a comprender el fondo del asunto. Me echais una mano? Me siento muy corto...

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 03 Mar 2009 01:17 am
El problema del formulario es muy sencillo de entender.
No envias la variable mensaje en el ActionScript, aunque la enviaras, no la recibes en el PHP, por tanto, no "funciona" como esperabas.

¿Que es lo que te llega al correo?

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 23 Mar 2009 02:22 am
Perdón por la tardanza e contestar pero sigo con el mismo problema. Sólo me llega un dato (el mail) de los 7 que se supone que deberían llegar... Sigo con ello... Y perdón por la pesadez, me siento un poco "corto" en estos asuntos... No hay ninguna aplicación para hacer formularios en flash? Y no tener que andar con el código y esas cosas que no pillo? Jejejeje... Uso mac, aunque tb tengo windows con parallels... Gracias de nuevo!!!

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 23 Mar 2009 10:28 am
Hola, prueba cambiando ese php por este:

Código PHP :

<?php
$email = $_POST["email"];
$name = $_POST["name"];
$phone = $_POST["phone"];
$current_date_display = $_POST["current_date_display"];
$appointment = $_POST["appointment"];
$reason = $_POST["reason"];
$mensaje = $_POST["mensaje"];
$address = $_POST["address"];

//-- Encabezados --//
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Tu Servicio <[email protected]>' . "\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . " \r\n";

//-- Mensaje --//
$message = '
<html>
<head>
  <title>message</title>
</head>
<body>
  <p>
       The e-mail is: ' . $email . ' <br/> 
       The name is: ' . $name . ' <br/>
       The phone is: ' . $phone . ' <br/>
       The current_date_display is: ' . $current_date_display . ' <br/>
       The appointment is: ' . $appointment . ' <br/>
       The reason is: ' . $reason . ' <br/>
       The message is: ' . $mensaje . ' <br/>
       The address is: ' . $address . ' <br/>
       Sent in ' . date('d/m/Y', time()) . ' <br/>
  </p>
</body>
</html>
';

$to  = '[email protected]';
$subject = 'Contact form';

if( mail($to, $subject, $message, $headers) )
{
   echo '&estatus=ok&';
}
else
{
   echo '&estatus=ko&';
}
?>


ASi debe de funcionar, y por cierto, ya exiten mejores soluciones para enviar mail, "phpmailer". Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 27 Mar 2009 01:50 pm
Si cambio el php por lo que me comentas, me llega esto al correo:

The e-mail is: [email protected]

Notes: undefined

Sent in 27/03/2009

Agggrrrr... Soy corto, soy corto, soy corto...

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 27 Mar 2009 02:00 pm
De hecho, siempre me llega eso... Haga lo que haga... Cómo envío y recibo la variable del mensaje? Ains!!!

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 27 Mar 2009 06:12 pm

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 31 Mar 2009 05:29 pm
Como se conecta phpmailer al flash? Por dios, no sé cómo puedo ser tan zoquete. Un ***AS*DFAS formulario!!! diossss!!! Tres meses para esta castaña y soy incapaz de hacerlo!!! Diossss... Vamos a ver, un último intento. Tengo esto en el flash:

Código :

enviar = function () {
    if (name_txt.text.length && address_txt.length && phone_txt.length && email_txt.length && appointment_txt.length && mensaje_txt.length) {
        if (email_txt.text.indexOf("@") != -1 && email_txt.text.indexOf(".") != -1) {
            form_lv = new LoadVars();
            form_lv.address = address_txt.text;
            form_lv.namea = namea_txt.text;
         form_lv.phone = phone_txt.text;
            form_lv.email = email_txt.text;
            form_lv.appointment = appointment_txt.text;
            form_lv.mensaje = mensaje_txt.text;
            form_lv.sendAndLoad("http://www.rgplanet.com/contactus/send.php", form_lv, "POST");
            mensaje_txt.text = "Enviando Mensaje..";
            namea_txt.text = "";
            address_txt.text = "";
            phone_txt.text = "";
            email_txt.text = "";
            appointment_txt.text = "";
            form_lv.onLoad = function() {
                if (this.estatus == "ok") {
                    mensaje_txt.text = "Tu mensaje fue enviado...";
                    namea_txt.text = "";
                    address_txt.text = "";
                    phone_txt.text = "";
                    email_txt.text = "";
                    appointment_txt.text = "";
                } else {
                    mensaje_txt.text = "Problemas con el servidornIntentalo de Nuevo";
                }
            };
        } else {
            email_txt.text = "Correo Invalido";
        }
    } else {
        address_txt.text = "Dato Necesario";
        namea_txt.text = "Dato Necesario";
        phone_txt.text = "Dato Necesario";
        email_txt.text = "Dato Necesario";
        appointment_txt.text = "Dato Necesario";
        mensaje_txt.text = "Dato Necesario";
    }
};
borrar = function () {
    address_txt.text = " ";
    namea_txt.text = " ";
    phone_txt.text = " ";
    email_txt.text = " ";
   mensaje_txt.text = " ";
    appointment_txt.text = " ";
};
enviar_btn.onRelease = enviar;
  borrar_btn.onRelease = borrar;



Y esto en el PHP que se llama send.php:

Código :

<?php
            if(isset($_POST["name"]) && isset($_POST["address"]) && isset($_POST["phone"]) && isset($_POST["email"]) && isset($_POST["appointment"]) && isset($_POST["mensaje"]) ){
            $fecha = date("d-M-y H:i");
            $mymail = "[email protected]";
            $subject = "Desde el Sitio.. =)";
            $contenido = $name." Escribio :\n";
            $contenido .= $address."\n\n";
            $contenido .= $phone."\n\n";
            $contenido .= $appointment."\n\n";
            $contenido .= $mensaje."\n\n";
            $contenido .= "el mensaje se escribio el ".$fecha;
            $header = "From:".$email."\nReply-To:".$email."\n";
            $header .= "X-Mailer:PHP/".phpversion()."\n";
            $header .= "Mime-Version: 1.0\n";
            $header .= "Content-Type: text/plain";
            mail($mymail, $subject, utf8_decode($contenido) ,$header);
            echo "&estatus=ok&";
            }
            ?>


Por favor, ayuda... Estoy desesperado. He intentado 20 mil códigos que no entiendo...

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 31 Mar 2009 06:34 pm
Dios, lo tengo lo tengo lo tengo, LO TENGO!!!! No había sentido tanto agobio en mucho tiempo y lo peor es que no sé casi cómo lo he hecho!! Jajajaja... Estoy tan contento que este fin de semana voy a hacerme un manual y, si a alguien del foro le interesa, lo podemos colgar o algo. Yo sé que es una chorrada pero estaba desesperado. Igual así puedo ayudar a gente que esté en mi misma situación... Gracias por vuestra ayuda!! Sin vosotros no lo habría conseguido!!!

Por rgplanet

61 de clabLevel



 

safari
Citar            
MensajeEscrito el 01 Abr 2009 03:03 am
(y) Puedes ver en el foro de tips como puedes editar un tip, tambien existe el foro de aportes. Suerte.

Por LongeVie

Claber

1741 de clabLevel

1 tutorial

Genero:Masculino  

En un lugar, re moto.

firefox
Citar            
MensajeEscrito el 30 Mar 2011 06:09 am

rgplanet escribió:

Dios, lo tengo lo tengo lo tengo, LO TENGO!!!! No había sentido tanto agobio en mucho tiempo y lo peor es que no sé casi cómo lo he hecho!! Jajajaja... Estoy tan contento que este fin de semana voy a hacerme un manual y, si a alguien del foro le interesa, lo podemos colgar o algo. Yo sé que es una chorrada pero estaba desesperado. Igual así puedo ayudar a gente que esté en mi misma situación... Gracias por vuestra ayuda!! Sin vosotros no lo habría conseguido!!!


POR FAVOR AYUDA ME PASA LO MISMO QUE A TI LLEVO MIL CODIGOS Y NO LLEGO A MI ERROR, POR FAVOR DIME COMO LE HICISTE :)

Por mayeya_mayeya

0 de clabLevel



 

safari

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.