# PHP Flash Form Problem #9125

**URL:** <https://forum.kirupa.com/t/php-flash-form-problem-9125/177097>\
**Category:** programming\
**Created:** [January 30, 2006, 7:15am UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097 "2006-01-30T07:15:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![niqhty](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@niqhty](https://forum.kirupa.com/u/niqhty)\
**Post date:** [January 30, 2006, 7:15am UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/1 "2006-01-30T07:15:40Z")

</div>

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.gotoandlearn.com/)  
[http://www.kirupa.com/developer/actionscript/flash\_php\_email.htm](http://www.kirupa.com/developer/actionscript/flash_php_email.htm)  
[http://ntdesigns.net/tutorial/Mailform.html](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](http://coconia.net)  
[flap17.net](http://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
<?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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![fuzzycow](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@fuzzycow](https://forum.kirupa.com/u/fuzzycow)\
**Post date:** [April 3, 2006, 9:46am UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/2 "2006-04-03T09:46:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nrirureta](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nrirureta](https://forum.kirupa.com/u/nrirureta)\
**Post date:** [April 3, 2006, 11:37am UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/3 "2006-04-03T11:37:49Z")

</div>

try this …

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

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

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

```

---

<div class="post-metadata">

**Author:** ![fuzzycow](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@fuzzycow](https://forum.kirupa.com/u/fuzzycow)\
**Post date:** [April 3, 2006, 6:11pm UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/4 "2006-04-03T18:11:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fuzzycow](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@fuzzycow](https://forum.kirupa.com/u/fuzzycow)\
**Post date:** [April 3, 2006, 8:39pm UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/5 "2006-04-03T20:39:25Z")

</div>

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

```auto
[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:

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

```

And…

```auto
[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?

---

<div class="post-metadata">

**Author:** ![fuzzycow](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@fuzzycow](https://forum.kirupa.com/u/fuzzycow)\
**Post date:** [April 3, 2006, 10:04pm UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/6 "2006-04-03T22:04:35Z")

</div>

Solution:

```auto

[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]}

```

---

<div class="post-metadata">

**Author:** ![nrirureta](https://avatars.discourse-cdn.com/v4/letter/n/57b2e6/32.png) [@nrirureta](https://forum.kirupa.com/u/nrirureta)\
**Post date:** [April 4, 2006, 7:28am UTC](https://forum.kirupa.com/t/php-flash-form-problem-9125/177097/7 "2006-04-04T07:28:11Z")

</div>

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