3 Replies Latest reply on Aug 31, 2009 7:40 PM by Marlene

    Flex form and PHP code

    Marlene Level 1


      I am trying to use the code from A flex Cookbook discussion called "Submitting a Flex form using PHP" The goal is to create a form in Flex and when submitted, have the form data emailed to myself. I have unfortunately spent the entire day on this so ANY HELP WOULD BE APPRECIATED. The original cookbook code is located at

      http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postI d=8523 The code (I enabled source view is at http://www.alexisjean.com/testMail.html. I get an error and never get the email. I have attached the source files in a zip and alse pasting in the code






      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">



      import mx.controls.Alert;

        private function sendInfo():void{

         if(user.text=="" || email.text=="" || message.text==""){

          mx.controls.Alert.show("Sorry, information appears to be missing!")

          } else {




        private function thanks(evt:Event):void{

          if (String(svc.lastResult)=="ok") mx.controls.Alert.show("Thanks! Your message has been sent.")

          else mx.controls.Alert.show("Sorry, there was a server error!")





      <mx:HTTPService id="svc" url="mail.php" method="POST" contentType="application/x-www-form-urlencoded" resultFormat="text" result="thanks(event)">









      <mx:FormItem label="Name"> <mx:TextInput id="user"/> </mx:FormItem>   

      <mx:FormItem label="Email"> <mx:TextInput id="email"/> </mx:FormItem>   

      <mx:FormItem label="Message"> <mx:TextArea width="211" height="117" id="message" /> </mx:FormItem>         

      <mx:FormItem> <mx:Button label="Submit" click="sendInfo()"/></mx:FormItem> 












      ini_set("sendmail_from", "testing@alexisjean.com");



      $email = $_POST['email'];

      $to = "testing@alexisjean.com";

      $from = "$email";

      $subject = "subject line tester";

      $msg ="Name: ".$_POST['user']."\nEmail: ".$_POST['email']."\nMessage: ".$_POST['message'])) echo "ok";

      else echo "error";