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
_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
<?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.