1

お問い合わせフォームを持つフラッシュでウェブサイトを開発しようとしています。

私のas3コード:

processing_mc.visible = false;
var variables:URLVariables = new URLVariables;

var varSend:URLRequest = new URLRequest("form_parse.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

var varLoader:URLLoader = new URLLoader();
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void { 
processing_mc.visible=false;
name_txt.text="";
email_txt.text="";
msg_txt.text="";
//load response on php here
status_txt.text="In submit button";
status_txt.text = event.target.data.return_msg;

}
//add event listener to Submit button
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
//function validate and send
function ValidateAndSend(event:MouseEvent):void{
//validate fields

if(!name_txt.length){
status_txt.text="Please enter your Name";
} else if(!email_txt.text){
status_txt.text="Please enter your E-mail address";
} else if(!msg_txt.text){
status_txt.text="Please enter your Message";
} else {
//all is good, send data to php
processing_mc.visible=true;
//ready the variables to send
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userMsg = msg_txt.text;
// send the data to php now.
varLoader.load(varSend);
}//close for error handling 
}//close validate and send function

PHP コード:

<?php

$senderName =$POST['userName'];
$senderEmail =$POST['userEmail'];
$senderMsg =$POST['userMsg'];

$senderName =stripslashes('userName');
$senderEmail =stripslashes('userEmail');
$senderMsg =stripslashes('userMsg');

$to="gidwani.hina14@gmail.com";
$from="$senderEmail";
$subject="enquiry";
$message=" Enquiry from:

Name:$senderName
Email:$senderEmail

The message sent :

Message:$senderMsg";

$headers= "From:$from\r\n";
$headers= "Content-type:text\r\n";
$to= "$to";

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

$my_msg="Thanks $senderName,your data has been sent";

print"return_msg=$my_msg";

exit();
?>

エラーが発生します:

TypeError: エラー #2007: パラメータ テキストは null 以外である必要があります。flash.text::TextField/set text() AS3_PHP_Components_Form_fla::wholeForm_1/completeHandler() flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction() flash.events::EventDispatcher/dispatchEvent() flash.net::URLLoader/flash.net:URLLoader::onComplete() で

どうしたの?

4

0 に答える 0