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!

I don't know much about action script, but your PHP code is correct, although a small thing I noticed, line 21 says PLease, Won't effect the code though, just wanted to point that out.

Possibly change $_REQUEST to $_POST though.

Thanks but converting to $_POST didn't work. And about PLease, it writes in another language in the actual code, I translated it to English before posting here and made a mistake there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.