Quantcast
Channel: Adobe Community : Popular Discussions - Using Flash Builder
Viewing all articles
Browse latest Browse all 70427

Submitting Form Data HTTPService

$
0
0

I would appreciate some help with this.  I am using Flash Builder 4.6 and I am trying to submit some form data to a php file so the php file can send an email.  I am not that experienced with this and was hoping someone can show me what I am doing wrong.  I am not too concerned about the lack of security in the php file yet as I am still trying to get it to send the email.

 

Here is the Flex Code:     

 

 

 

            <![CDATA[

            import mx.rpc.events.ResultEvent;

            import mx.rpc.events.FaultEvent;

            import mx.controls.Alert;

                                   

            publicfunction handlePlain(event:ResultEvent):void

            {

            Alert.show("OK Good");

            }

                                   

            publicfunction handleFault(event:FaultEvent):void

            {

            Alert.show(event.fault.faultString, "Error");

            }

            ]]>

</fx:Script>

           

           

<fx:Declarations>

 

<s:HTTPService id="login_email"

               result="handlePlain(event);"

               fault="handleFault(event);"

               method="POST"

               url="http://mydomain.com/email.php"

               useProxy="false">

 

<mx:request xmlns="">

            <firstname>{first_name.text}</firstname>

            <lastname>{last_name.text}</lastname>

            <email>{email.text}</email>

            <comment>{comments.text}</comment>

            </mx:request>       

 

</s:HTTPService>

                       

 



 

 

 

 

 

 

 

Here is the PHP File:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

</head>

 

<body>

 

<?php

 

            $first = $_POST['first_name'];

            $last = $_POST['last_name'};

            $email = $_POST['email'];

            $comments = $_POST['comments'];

           

            $to = 'myemailaddress@aol.com';

            $subject = 'Contact from EPK';

            $msg =  "$first\n"."$last\n"."email\n"."comments\n";

                                   

            mail($to, $subject, $msg, 'From: ".$email);

           

?>                  

</body>

</html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any help would be greatly appreciated.

Thanks


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>