Flash email form (Flash+PHP)

[_Silence_]

OC Legend
Boas,
Preciso de através de um Flash enviar certos dados por email, por exemplo a pessoa entra no site em Flash, preenche um formulário com o nome, morada, telefone e referência. A cada campo de texto input tenho uma var associada e no botão de submit tenho o código para enviar as variáveis por método $_POST para um ficheiro PHP chamado email.php que tenho na mesma directoria do ficheiro Flash.

No ficheiro PHP tenho o seguinte código:

Código:
<?php
/***************************************************\
 * PHP 4.1.0+ version of email script. For more
 * information on the mail() function for PHP, see
 * http://www.php.net/manual/en/function.mail.php
\***************************************************/


// First, set up some variables to serve you in
// getting an email.  This includes the email this is
// sent to (yours) and what the subject of this email
// should be.  It's a good idea to choose your own
// subject instead of allowing the user to.  This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "[email protected]";
$subject = "Encomenda - NASSQ";

// variables are sent to this PHP page through
// the POST method.  $_POST is a global associative array
// of variables passed through this method.  From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable.  First, include From:
$headers = "From: " . $_POST["name"] ." <" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own.  The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$message = $_POST["morada"];




// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

?>

Ele assim funciona, eu recebo o mail com o nome da pessoa, o subject e no corpo da mensagem está o conteúdo da variável "morada". O meu problema é que além da "morada" no corpo da mensagem preciso de outras variáveis, como o "telefone" e a "referência" e não o estou a conseguir. Alguém me arranja uma solução?

Se a explicação do problema estiver um pouco confusa avisem que eu esclareço :)

Cumps
Diogo
 
[_Silence_];1739855 disse:
Boas,
Preciso de através de um Flash enviar certos dados por email, por exemplo a pessoa entra no site em Flash, preenche um formulário com o nome, morada, telefone e referência. A cada campo de texto input tenho uma var associada e no botão de submit tenho o código para enviar as variáveis por método $_POST para um ficheiro PHP chamado email.php que tenho na mesma directoria do ficheiro Flash.

No ficheiro PHP tenho o seguinte código:

Código:
<?php
/***************************************************\
 * PHP 4.1.0+ version of email script. For more
 * information on the mail() function for PHP, see
 * http://www.php.net/manual/en/function.mail.php
\***************************************************/


// First, set up some variables to serve you in
// getting an email.  This includes the email this is
// sent to (yours) and what the subject of this email
// should be.  It's a good idea to choose your own
// subject instead of allowing the user to.  This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "[email protected]";
$subject = "Encomenda - NASSQ";

// variables are sent to this PHP page through
// the POST method.  $_POST is a global associative array
// of variables passed through this method.  From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable.  First, include From:
$headers = "From: " . $_POST["name"] ." <" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own.  The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$message = $_POST["morada"];




// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

?>

Ele assim funciona, eu recebo o mail com o nome da pessoa, o subject e no corpo da mensagem está o conteúdo da variável "morada". O meu problema é que além da "morada" no corpo da mensagem preciso de outras variáveis, como o "telefone" e a "referência" e não o estou a conseguir. Alguém me arranja uma solução?

Se a explicação do problema estiver um pouco confusa avisem que eu esclareço :)

Cumps
Diogo


se tiveres a enviar bem as variáveis pelo flash é fácil, basta fazeres algo deste tipo:

PHP:
$message = "Morada: ".$_POST["morada"]."\n";
$message.="Telefone: ".$_POST["telefone"]."\n";
$message.="Referência: ".$_POST["referencia"]."\n";
//etc, etc, etc, consoante a informação que queiras enviar

o "\n" (ou "\r\n") no fim da instrução é só para fazer a mudança de linha, mas podes usar outro separador kker
 
se tiveres a enviar bem as variáveis pelo flash é fácil, basta fazeres algo deste tipo:

PHP:
$message = "Morada: ".$_POST["morada"]."\n";
$message.="Telefone: ".$_POST["telefone"]."\n";
$message.="Referência: ".$_POST["referencia"]."\n";
//etc, etc, etc, consoante a informação que queiras enviar

o "\n" (ou "\r\n") no fim da instrução é só para fazer a mudança de linha, mas podes usar outro separador kker

Assim que puder exprimento, tks :)
 
Esse código funcionou, obrigado :)

Agora estou com outro problema, funciona tudo bem mas não sei como definir um character set para os acentos aparecerem bem.

Código actual:

Código:
<?php
/***************************************************\
 * PHP 4.1.0+ version of email script. For more
 * information on the mail() function for PHP, see
 * http://www.php.net/manual/en/function.mail.php
\***************************************************/


// First, set up some variables to serve you in
// getting an email.  This includes the email this is
// sent to (yours) and what the subject of this email
// should be.  It's a good idea to choose your own
// subject instead of allowing the user to.  This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "[email protected]";
$subject = "Encomenda";

// variables are sent to this PHP page through
// the POST method.  $_POST is a global associative array
// of variables passed through this method.  From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable.  First, include From:
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = "From: " . strip_tags($_POST["nome"]) ." <" . strip_tags($_POST["email"]) .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . strip_tags($_POST["email"]) . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own.  The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . strip_tags($_POST["email"]);


// now we can add the content of the message to a body variable
$message .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message = "Nome: ".strip_tags($_POST["nome"])."\n";
$message = "Morada: ".strip_tags($_POST["morada"])."\n";
$message.="Telefone: ".strip_tags($_POST["telefone"])."\n";
$message.="E-Mail: ".strip_tags($_POST["email"])."\n";
$message.="Referência: ".strip_tags($_POST["referencia"])."\n";
$message.= "Content-type: text/html;charset=iso-8859-1";


// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

?>

O que preciso de acrescentar para aparecerem acentos e "ç"?
 
boas.. qual o código que escreves no flash.. eu tenho algo do género

on (rollOver)
{
gotoAndPlay("s1");
}
on (releaseOutside, rollOut)
{
gotoAndPlay("s2");
}
on (release)
{
getURL("http://imagine-se.com/gmail.php", "", "POST");

for (i = 1; this["field_" + i]; i++)
{
this["field_" + i] = "";
} // end of for
_parent.message = "email enviado. obrigado.";
_parent.your_name = "";
_parent.your_email = "";
_parent.field_1 = "";
}


e nao funciona... quando carrego em submeter... abre outra pagina no explorer em branco


help me :D
 
Back
Topo