1 Reply Latest reply on Apr 12, 2010 10:57 PM by kglad

    I am having trouble with my forms.

    mariahpoo

      At first I thought it was the fact that flash was not publishing the AC_RunActiveContent.js file. But when I dug deeper I guess in flash cs4 the AC_RunActiveContent.js file is not needed anymore.

       

      So why are my forms not working?

       

      Here is the PHP I am using:

       

      <?php

       

      $sendto = 'email@email.net';
      $subject = 'Email from Advance Automotive Appointments';
      $name = $_POST['fromname'];
      $wkphone = $_POST['fromwkphone'];
      $hmphone = $_POST['fromhmphone'];
      $from = $_POST['fromemail'];
      $time = $_POST['fromtime'];
      $date = $_POST['fromdate'];
      $year = $_POST['fromyear'];
      $make = $_POST['frommake'];
      $model = $_POST['frommodel'];
      $message = $_POST['frommessage'];
      $message = stripslashes($message);

       

      $content = "Name: " . $name . "\n";
      $content .= "Work phone: " . $wkphone . "\n";
      $content .= "Home phone: " . $hmphone . "\n";
      $content .= "Email: " . $from . "\n\n";
      $content .= "Time: " . $time . "\n";
      $content .= "Date: " . $date . "\n";
      $content .= "Year: " . $year . "\n";
      $content .= "Make: " . $make . "\n\n";
      $content .= "Message: " $message;

       

      If(mail($sendto,$subject,$content))
      {
      echo 'response=passed';
      }
      else
      {
      echo 'response=failed';
      }

       

      ?>

       

      And here is the FLASH action script:

       

       

      send_btn.addEventListener(MouseEvent.CLICK,submit);

       

      function submit(e:MouseEvent):void
      {
          var variables:URLVariables = new URLVariables();
          variables.fromname = name_txt.text;
          variables.fromwkphone = workph_txt.text;
          variables.fromhmphone = homeph_txt.text;
          variables.fromemail = email_txt.text;
          variables.fromtime = time_txt.text;
          variables.fromdate = date_txt.text;
          variables.fromyear = year_txt.text;
          variables.frommake = make_txt.text;
          variables.frommodel = model_txt.text;
          variables.frommessage = message_txt.text;
         
          var req:URLRequest = new URLRequest("appt.php");
          req.data = variables;
          req.method = URLRequestMethod.POST;
         
          var loader:URLLoader = new URLLoader();
          loader.dataFormat = URLLoaderDataFormat.VARIABLES;
          loader.addEventListener(Event.COMPLETE,sent);
          loader.addEventListener(IOErrorEvent.IO_ERROR,error);
          loader.load(req);
          status_txt.text = "Sending...";
      }

       

      function sent(e:Event):void
      {
          status_txt.text = "Your message has been sent.";
          name_txt.text = "";
          workph_txt.text = "";
          homeph_txt.text = "";
          email_txt.text = "";
          time_txt.text = "";
          date_txt.text = "";
          year_txt.text = "";
          make_txt.text = "";
          model_txt.text = "";
          message_txt.text = "";
      }

       

      function error(e:IOErrorEvent):void
      {
          status_txt.text = "There has been an Error, Please try again later.";
      }

       

       

      So what am I doing wrong?