# Structure and SendAndLoad

**URL:** <https://forum.kirupa.com/t/structure-and-sendandload/249577>\
**Category:** flash\
**Created:** [January 20, 2008, 11:17am UTC](https://forum.kirupa.com/t/structure-and-sendandload/249577 "2008-01-20T11:17:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [January 20, 2008, 11:17am UTC](https://forum.kirupa.com/t/structure-and-sendandload/249577/1 "2008-01-20T11:17:18Z")

</div>

Hi, I am trying to work out sending an email using LoadVars, sendAndLoad and PHP.  
I have my code right when I use it from the \_root swf. However Im using a slightly more complicated structure (for me at least), and my code isnt firing.

\_level0 (index.swf) content\_mc (menu.swf) newMovie (contact.swf)  
So, when I get to the contact.swf, I have a send button (which handles the sendAndLoad).  
This is found at

```auto
_level0.content_mc.newMovie.send_mc.onRelease = function (){
   
    var sender:LoadVars = new LoadVars();
    
    sender.email_txt = email_txt.text;
    
    var receiver:LoadVars = new LoadVars();
    sender.sendAndLoad("scripts/message.php",receiver);
    
    receiver.onLoad = function(success:Boolean){
        if(!success){
            _level0.content_mc.newMovie.email_txt.text = "Connection Failed";
            return;
        }
        
        if( receiver.confirmation == "true" )
        {
            _level0.content_mc.newMovie.email_txt.text = "Thank You";
        }    
    }
}

```

My PHP file looks like this

```auto
<?php

$to = "email@yahoo.co.uk";
$subject = "Email from Website";
$email_txt = $_POST['email_txt'];
 
$body = "Message: $email_txt
";
 
echo "confirmation=true";
mail($to, $subject, $body);

?>

```

Unfortunately I cant get my dynamic ‘email\_txt’ box to respond accordingly. Can anyone see where I have gone wrong? It seems to get lost because of its structure.
