PHP Flash Form Problem #9125

I’d say that I’ve spent more than 4 hours trying to figure out this one, tiny thing.

The form won’t send an email.

I’ve tried three different PHP/Flash Form tutorials:
http://www.gotoandlearn.com/
http://www.kirupa.com/developer/actionscript/flash_php_email.htm
http://ntdesigns.net/tutorial/Mailform.html

I’ve set them up just as I’m instructed, and I’ve checked the forums for a problem like mine, but none of them helped. I’ve seen some threads where people get an email, but it was blank. In my case, I don’t even receive the email.

With each of them, when I click the “Send” button, it doesn’t complete the action. I see that the browser is trying to grab the php file, but it never says “Mail Sent” or whatever it should say if the email has sent.

I’ve tried two free php hosts, and maybe that’s the problem.
coconia.net
flap17.net
And freewebs, but I’m not even sure if that supports PHP.

Does anyone have a free host that, for sure, supports PHP?
Or, otherwise, does anyone have any idea why this might not be working?

This is the code for the “goto and learn” page, which I actually thought would work.

<?php

$to = "qrounded@yahoo.com";
$subject = "Flash Contact Form Submission";
$message = "Name: " . $theName;
$message .= "
Email: " . $theEmail;
$message .= "

Message: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "
Reply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

and here is the Actionscript.

stop();

var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

sender.onRelease = function() {
    senderLoad.theName = theName.text;
    senderLoad.theEmail = theEmail.text;
    senderLoad.theMessage = theMessage.text;
    senderLoad.sendAndLoad("http://jaygou.coconia.net/send.php",receiveLoad);
}

receiveLoad.onLoad = function() {
    if(this.sentOk) {
        _root.gotoAndStop("success");
    }
    else {
        _root.gotoAndStop("failed");
    }
}


Please reply if you have any thoughts.

Thanks.

Yeap… I think the problem with mine is my form is nested in a movie clip and the variable “sentOk” is not communicating with it… any ideas?

try this …

[COLOR=Red]receiveLoad.onLoad = function() {

   loadVariables("http://somesite/mail.php", this, "GET");

if(this.sentOk) {
        _root.gotoAndStop("success");
    }
    else {
        _root.gotoAndStop("failed");
    }
}[/COLOR]       

nrirureta,

thanks, but it did not resolve my problem. Is there a way to configure the PHP script to send the “sentOk” variable directly to the movieclip timeline?

I figured out the problem. Nrirureta, my apologies, your reply was indeed a solution. My problem is here:

[COLOR=#ff0000]        [/COLOR]
[COLOR=#ff0000]_root.gotoAndStop("success");
    }
    else {
        _root.gotoAndStop("failed");
    }[/COLOR]

My movie structure is as follows:
MainMovie.swf that contains a movieClip instance (“container”) that loads external SWF’s. Contact.swf is loaded into the “container” movieClip. Contact.swf has a movieClip named “form”, that is where all the AS for the form resides.

The form works perfectly fine when it doesn’t load into the MainMovie.swf. When it is loaded it wont go to the specified labels (“success” and “failed”).

I have tried:

[COLOR=#ff0000]       [/COLOR]
[COLOR=#ff0000] this.gotoAndStop("success");
    }
    else {
        this.gotoAndStop("failed");
    }[/COLOR]

And…

[COLOR=#ff0000]       [/COLOR]
[COLOR=#ff0000] _root.form.gotoAndStop("success");
    }
    else {
        _root.form.gotoAndStop("failed");
    }[/COLOR]

With no luck. Any ideas on how I might get this to work?

Solution:


[COLOR=red]receiveLoad.onLoad = function() {
 loadVariables("[/COLOR][[COLOR=red]http://www.website.com/send.php[/COLOR]](http://www.website.com/send.php)[COLOR=red]", this, "GET");
 if(this.sentOk) {
        _parent.form.gotoAndStop("success");
    }
    else {
        _parent.form.gotoAndStop("failed");
    }
[/COLOR]}

i didnt know the structure of your movie…
but im glad u solved your problem… :party: