0

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!

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by newbiecoder
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.