Flash Form with PHP problem

hi,

i am trying to develop a contact form in Flash MX 2004 which sends an email from my site using a php script. My send button has the following code.

on (release) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
form.loadVariables(“http://localhost/email.php”, “POST”);
gotoAndPlay (“results”);
}

If I remove the gotoAndPlay statement, the email sends fine but with this included, the movie jumps to the results frame and the mail is not sent. From scouring the web, the answer seems to be to use LoadVars to wait for response from the script but i cant seem to get this to work.

Initially, I just want to get the mail to send and the user to see the thanks message (which is displayed from the “results” frame). I can then refine it later as I’m working to a deadline.

Any help would be much appreciated. You can see the contact form here:

www.lukem.co.uk (click contact).

Many thanks,

Luke.

php script:

$sendTo = "luke@lukem.co.uk";
$subject = "feedback from lukem site, mailer option ". $_POST[“mailer”];

// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = “From: " . $_POST[“name”];
$headers .= “<” . $_POST[“email”] .”>
";
// next include a Reply-To:
$headers .= "Reply-To: " . $_POST[“email”];

// now we can add the content of the message to a body variable
$message = $_POST[“message”];

mail($sendTo, $subject, $message, $headers);

if(mail($sendTo, $subject, $message, $headers)) {
echo “Okay”;
} else {
echo “Fail”;
}

?>