Hi ,
I have an issue. I have made a website in flash and the contact form is designed and linked with php
as3 code:
[code]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);
//funtion 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
[/code]
php code:
[php]
<?php $senderName =$POST['userName']; $senderEmail =$POST['userEmail']; $senderMsg =$POST['userMsg']; $senderName =stripslashes('userName'); $senderEmail =stripslashes('userEmail'); $senderMsg =stripslashes('userMsg'); $to="[email protected]"; $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(); ?>[/php]
but i m getting an error:
TypeError: Error #2007: Parameter text must be non-null.
at flash.text::TextField/set text()
at AS3_PHP_Components_Form_fla::wholeForm_1/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Somehow i m unable to figure the prob…Please help…