# (help!) PHP email bug through flash

**URL:** <https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275>\
**Category:** programming\
**Created:** [June 4, 2008, 3:22pm UTC](https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275 "2008-06-04T15:22:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![korpela2](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@korpela2](https://forum.kirupa.com/u/korpela2)\
**Post date:** [June 4, 2008, 3:22pm UTC](https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275/1 "2008-06-04T15:22:44Z")

</div>

Hi all,

Im trying to send an email from a swf using PHP. The data is received from dynamic text boxes in the swf with variable names:

\_global.Email  
\_global.FirstName  
ToCharity  
Company

the php code recognises the “_$ToCharity_” and “_$Company_” correctly, but for the other two it prints the following instead of the actual textbox content: “Email” and “FirstName”

Im not a rocket scientist but my gut feeling tells me it has something to do with the “_\_global_” part. Is there something to work around this?

---

<div class="post-metadata">

**Author:** ![korpela2](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@korpela2](https://forum.kirupa.com/u/korpela2)\
**Post date:** [June 4, 2008, 4:11pm UTC](https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275/2 "2008-06-04T16:11:26Z")

</div>

> [@ahmednuaman;2336515](#):
>
> Can we see your Flash and PHP code?

**This would be my actionscript (2.0):**

```auto

//attached onto a button
on (release) {
        _root.slash_snd.start(0, 1);
        loadVariablesNum ("donateMailPHP.php", "0", "Post");
        EmailStatus = "Sending... one Moment Please...";
        gotoAndStop(356);
}

```

**And this is my PHP:**

```php

<?
$from = "Blaa";
$ToEmail = "blaa@gmail.com";
##$ToName = "Blaa person";
$ToSubject = "Blaa Donation";

$EmailBody = "The following data displays details:

Donator's Name: $_global.FirstName
Donator's Company: $Company;
Donator's Email: $_global.Email
Chosen Charity: $ToCharity

";

$EmailFooter="Thank You";
$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$from." <".$_global.Email.">");

Print "_root.EmailStatus=Complete - Your details have been sent to us";
?>

```

---

<div class="post-metadata">

**Author:** ![korpela2](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@korpela2](https://forum.kirupa.com/u/korpela2)\
**Post date:** [June 5, 2008, 10:52am UTC](https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275/3 "2008-06-05T10:52:39Z")

</div>

> [@ahmednuaman;2336530](#):
>
> Ok, PHP’s a world apart from AS. For example, a var in PHP starts with a $ sign. So, you’re sending Email and FirstName, they should be called $\_POST[‘Email’] and $\_POST[‘FirstName’] respectively in PHP. Try that.

* * *

After trying this, the result was that the variables “$\_POST[‘Email’]” and “$\_POST[‘FirstName’]” were left blank.

This is my adjusted the code:

```php

 <?
$FirstName = $_POST['_global.FirstName'];
$Email = $_POST['_global.Email'];
 $Company = $_POST['_global.Company'];

$from = "$FirstName";
$ToEmail = "blaa@gmail.com";
##$ToName = "Blaa person";
$ToSubject = "Blaa Donation";

$EmailBody = "The following data displays details:

Donator's Name: $FirstName
Donator's Company: $Company;
Donator's Email: $Email

";

$EmailFooter="Thank You";
$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$from." <".$Email.">");

Print "_root.EmailStatus=Complete - Your details have been sent to us";
?> 

```

---

<div class="post-metadata">

**Author:** ![korpela2](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@korpela2](https://forum.kirupa.com/u/korpela2)\
**Post date:** [June 5, 2008, 11:41am UTC](https://forum.kirupa.com/t/help-php-email-bug-through-flash/262275/4 "2008-06-05T11:41:09Z")

</div>

Where should these variables be shown, in the swf?

What’s happening now is that the email is sending the same message - blank variables, but the “_\_root.EmailStatus_” in the swf does not show any response.

It maintains a previous text entry of “_Sending… one Moment Please…_”.
