Hello I tried to make a contact form for my Flash website but when I upload it to my server it just doesn't work. Can you tell me what is wrong with my codes or doesn't it work because of a server-side problem?
Here is my Actionscript code on Flash:
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
InteractiveObject(theName.getChildAt(1)).tabIndex = 1;
InteractiveObject(theEmail.getChildAt(1)).tabIndex = 2;
InteractiveObject(theMessage.getChildAt(1)).tabIndex = 3;
var allVars:URLVariables = new URLVariables();
var asdLoader:URLLoader = new URLLoader();
var mailAddress:URLRequest = new URLRequest("mailer.php");
send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_7);
function fl_MouseClickHandler_7(event:MouseEvent):void
{
if (theName.text == "" || theEmail.text == "" || theMessage.text == "")
{
theFeedback.text = "PLease fill all fields.";
}
else
{
allVars.name = theName.text;
allVars.email = theEmail.text;
allVars.message = theMessage.text;
mailAddress.data = allVars;
mailAddress.method = URLRequestMethod.POST;
asdLoader.addEventListener(Event.COMPLETE, loaded);
asdLoader.load(mailAddress);
theName.text = "";
theEmail.text = "";
theMessage.text = "";
}
}
function loaded(e:Event):void
{
theFeedback.text = asdLoader.data;
}
here is the code of mailer.php
<?php
$name = $_REQUEST["name"];
$message = $_REQUEST["message"];
$to = $_REQUEST["email"];
$message = stripslashes($message);
$name = stripslashes($name);
$to = stripslashes($to);
if(isset($message) and isset($subject) and isset($sender)){
mail("johndoe@gmail.com", "mail from the website", $message, "From: $to");
}
?>
Thanks in advance!