Hi,
I’m quite new at scripting with components and I’m trying to create a simple email contact form using Flash 8 and PHP…
http://www.drake-place.co.uk/contactform.html
However, when I click submit (with the fields filled in), the form contacts the PHP and sends a blank email to my address. Can someone please help me set it so that my textfields data is sent to the PHP and then sends an email to my address? I have tried everything I know so far, and I am now at a loss.
The ActionScript I am using is:
stop();
yourname = _root.form_mc.name_ti.text;
youremail = _root.form_mc.email_ti.text;
yourcomments = _root.form_mc.message_ti.text;
var submit_pbListener:Object = new Object();
submit_pbListener.click = function () {
_root.loadVariables("http://www.drake-place.co.uk/email2.php", "POST");
};
submit_pb.addEventListener ("click", submit_pbListener);
var reset_pbListener:Object = new Object();
reset_pbListener.click = function () {
form_mc.name_ti.text = "";
form_mc.email_ti.text = "";
form_mc.message_ti.text = "";
};
reset_pb.addEventListener ("click", reset_pbListener);
and the PHP code is:
<?php
$sendTo = "nathan@drake-place.co.uk";
$subject = "Drake-place response";
$headers = "From: " . $_POST["yourname"] ." <" . $_POST["youremail"] .">
";
$headers .= "Reply-To: " . $_POST["youremail"] . "
";
$headers .= "Return-path: " . $_POST["youremail"];
$message = $_POST["yourcomments"];
mail($sendTo, $subject, $message, $headers);
?>
I hope someone can tell me where I’m going wrong
Thanks