E_Rock Posted June 3, 2010 Share Posted June 3, 2010 So basically I'm making a quote request form in flash for my dad and everything is working perfectly... EXCEPT that when you click submit it's supposed to read back "Thanks $senderName, you quote request has been submitted" but strangely it reads back my entire Php code... Any help would be awesome ! <?php //Creat local variables from Flash ActionScript posted variables $senderName =$_POST['userName']; $senderCompany =$_POST['userCompany']; $senderEMail =$_POST['userEMail']; $senderPhone =$_POST['userPhone']; $senderComment =$_POST['userComment']; $senderStandardStock =$_POST['userStandardStock']; $senderStandardQuantity =$_POST['userStandardQuantity']; $senderMonarchStock =$_POST['userMonarchStock']; $senderMonarchQuantity =$_POST['userMonarchQuantity']; $sender1stColor =$_POST['user1stColor']; $sender2ndColor =$_POST['user2ndColor']; $senderEmboss =$_POST['userEmboss']; $senderFoilStamp =$_POST['userFoilStamp']; $senderStockSupplied =$_POST['userStockSupplied']; $senderFoilE =$_POST['userFoilE']; $senderMGT =$_POST['userMGT']; //Strip slashes on the Local typed-in variables for security and run any PHP based error check here $senderName =stripslashes($senderName); $senderCompany =stripslashes($senderCompany); $senderEMail =stripslashes($senderEMail); $senderPhone =stripslashes($senderPhone); $to ="websales@winsted-thermo.com"; $from ="$senderEMail"; $subject ="Quote Request from $senderName at $senderCompany"; $message="Quote Request from $senderCompany Name: $senderName E-Mail: $senderEMail Company: $senderCompany Phone #: $senderPhone Stock: Standard:$senderStandardStock Monarch:$senderMonarchStock Quantity: Standard:$senderStandardQuantity Monarch:$senderMonarchQuantity Color 1st: $sender1stColor 2nd: $sender2ndColor Embossing?: $senderEmboss Foil Stamping?: $senderFoilStamp Foil Embossing?: $senderFoilE Metallic Gold Thermography?: $senderMGT Stock Supplied?: $senderStockSupplied Additional Comments: $senderComment"; //Build $headers Variable $headers = "From: $from\r\n"; $headers = "Content-type: text\r\n"; $to = "$to"; // Send the EMail mail($to, $subject, $message, $headers); //Assemble the message that goes back to flash //The flash ActionScpri is looking for a return of "return_msg" $my_msg= "Thanks $senderName, your quote request has been sent."; //Print the data back to flash who is patiently waiting for it in the onCompleteHandler print "return_msg=$my_msg"; //Exit script exit(); ?> V--Part of my AS3 coding--V // upload_btn function var uploadCLICKURL:URLRequest = new URLRequest("uploadFile.html"); upload_btn.addEventListener(MouseEvent.CLICK, uploadCLICK); function uploadCLICK(event:MouseEvent):void { navigateToURL(uploadCLICKURL,"_blank"); } //Build the varSend varialble var variables:URLVariables=new URLVariables; var varSend:URLRequest=new URLRequest("form_parse.php"); varSend.method=URLRequestMethod.POST; varSend.data=variables; //Build the varLoader variable var varLoader:URLLoader=new URLLoader; varLoader.dataFormat = URLLoaderDataFormat.VARIABLES; varLoader.addEventListener(Event.COMPLETE, completeHandler); //handler for the PHP script completion and return of status function completeHandler(event:Event):void { process_mc.visible = false; Name.text=""; Company.text=""; E_Mail.text=""; Phone.text=""; Comment.text=""; Emboss.selected=false; FS.selected=false; S_Supplied.selected=false; FoilE.selected=false; MGT.selected=false; //Load the response php here status_txt.text=String(event.target.data)<--- This is where it's supposed to pull the response message from my php file } // Add event listner for submit button click submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend); // function ValidateAndSend function ValidateAndSend(event:MouseEvent):void { // Validate Email Function function validateEmailAddress(emailString:String):Boolean { var myRegEx:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/; var myResult:Object = myRegEx.exec(emailString); if (myResult == null) { return false; } return true; } if (!Name.length) { status_txt.text="*Please fill in all the text feilds"; } else if (!Company.length) { status_txt.text="*Please fill in all the text feilds"; } else if (!E_Mail.length) { status_txt.text="*Please fill in all the text feilds"; } else if (validateEmailAddress(E_Mail.text) == false) { status_txt.text = "Please enter a VALID email address."; } else if (!Phone.length) { status_txt.text="*Please fill in all the text feilds"; } else { //All is good, send the data now to PHP process_mc.visible = true; //ready the variables in our form for sending variables.userName=Name.text; variables.userCompany=Company.text; variables.userEMail=E_Mail.text; variables.userPhone=Phone.text; variables.userComment=Comment.text; variables.userStandardStock=S_Stock.value; variables.userStandardQuantity=S_Quantity.value; variables.userMonarchStock=M_Stock.value; variables.userMonarchQuantity=M_Quantity.value; variables.user1stColor=Ink_Color1.value; variables.user2ndColor=Ink_Color2.value; variables.userEmboss=Emboss.selected; variables.userFoilStamp=FS.selected; variables.userStockSupplied=S_Supplied.selected; variables.userFoilE=FoilE.selected; variables.userMGT=MGT.selected; //Send the datd to PHP now varLoader.load(varSend); }// close else condition for error handling }//close ValidateAndSend Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/ Share on other sites More sharing options...
trq Posted June 3, 2010 Share Posted June 3, 2010 Does your server have php enabled and configured properly? Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/#findComment-1067182 Share on other sites More sharing options...
E_Rock Posted June 3, 2010 Author Share Posted June 3, 2010 yeah i believe so. i'm using godaddy Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/#findComment-1067191 Share on other sites More sharing options...
trq Posted June 3, 2010 Share Posted June 3, 2010 Well, if its returning php code there is something misconfigured. Can you get a simple phpinfo page to display? eg <?php phpinfo(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/#findComment-1067198 Share on other sites More sharing options...
E_Rock Posted June 3, 2010 Author Share Posted June 3, 2010 yessir http://winsted-thermo.com/phptext.php Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/#findComment-1067200 Share on other sites More sharing options...
E_Rock Posted June 3, 2010 Author Share Posted June 3, 2010 okay i changed some stuff and now its sort of giving me what i want... "return%5Fmsg=Thanks%20fdfsdf%2C%20your%20quote%20request%20has%20been%20sent%2E" Quote Link to comment https://forums.phpfreaks.com/topic/203757-php-w-flash-component-form/#findComment-1067203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.