Flash stronger then PHP?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have tried several times to make the flash website to communicate
with the PHP script i have on the server, but it does not work. It
should work in this way: when the fields on the forms are all "not
blank" send the mail. The PHP then should be in charge to send the
email to the destination address.

The files are:

PHP (server side):

// get the externl variables
$destMail = $_REQUEST["destMail"];
$senderName = $_REQUEST["senderName"];
$senderMail = $_REQUEST["snderMail"];
$senderSubject = $_REQUEST["senderSubject"];
$senderBody = $_REQUEST["senderBody"];
// add header info
$header = "From: $senderName <senderMail>\br";
$header .= "Replay-To: $senderName <senderMail>\br";
// invio della mail: destinatario, subject, coprpo della mail, header
mail($destMail, $senderSubject, $senderBody, $header);

While the FLASH script is:

fieldsFilled = new Object();
fieldsFilled.onKeyUp = function()
        if (destMail_txt.text != '' && senderName_txt.text != '' &&
senderMail_txt.text != '' && senderSubject_txt.text != '' &&
senderBody_txt.text != '') {
        send_btn.enabled = true;
        send_btn.enabled = false;
send_btn.enabled = false;
var sendMail_lv:LoadVars = new LoadVars();
send_btn.onRelease = function()
        sendMail_lv.destMail = destMail_txt.text;
        sendMail_lv.senderName = senderName_txt.text;
        sendMail_lv.senderMail = senderMail_txt.text;
        sendMail_lv.senderSubject = senderSubject_txt.text;
        sendMail_lv.senderBody = senderBody_txt.text;
        // invio i dati tramite sedandload
        sendMail_lv.sendAndLoad("http://PATH TO MY SERVER/sendMail.php",
sendMail_lv, "POST");

Thanks a lot.

Re: Flash stronger then PHP?

Quoted text here. Click to load it

my understanding is that the variables recieved should look like this
$destMail = $_POST["destMail"];
and so on.  you can always use the following script to make sure that
your send the varibles to php...
foreach ($_POST as $key=>$value) {
  $received .= "$key = $value\r\n";

$printout = fopen("variables.txt", "w");
fwrite($printout, $received);

That will list the varibles passed to it from flash.  Hope this helps.

Re: Flash stronger then PHP?

check our AMFPHP, works much smoother and allows your flash to talk
directly to your php objects - READ THE INSTRUCTIONS, its a bid weird
settign it up.


Re: Flash stronger then PHP?

Quoted text here. Click to load it

Thanks Phil,
What is AMFPHP?

Re: Flash stronger then PHP?

vinnie wrote:

Quoted text here. Click to load it

$senderMail = $_REQUEST["senderMail"];

Quoted text here. Click to load it

$header = "From: $senderName <$senderMail>\r\n";
$header .= "Reply-To: $senderName <$senderMail>\r\n";

Possibly other errors too.

By the way, this script has big security holes and may lead to your server
being blacklisted.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 50 days, 16:12.]

                       Command Line Interfaces, Again

Site Timeline