My form is designed as an email contact form but at the moment because i dont have a local mail server configured im using the fwrite functions in PHP to illustrate that it works and to save the values of the variables to a text file to prove they are working, if it comes to rolling it out then i can use the mail function just by editting the PHP.
<mx:HTTPService id="sendmycontact" url="contact.php" result="resulthandler(event)" resultFormat="text" method="POST" >
First of course there is the HTTPService tag. Basically similar (as far as i can tell) to the <form> HTML tag. You specify the URL which is the "action" of a <form> and then of course the method, POST, GET and others i cant remember! all you need for a very basic form is the URL and the action parts and of course the ID which is used later to submit it. The interesting part is the "result" property. This is a property that defines what to do if/when the form receives an answer from the script, in my example i used the php: or die("failed") to provide feedback to the flex form. It automatically receives the text "failed" if the PHP encounters an error (for example your mail server dies and your user thinks a message has been sent but it hasnt. The error handler will notify the user of an error). In my example i created a function that i will explain in a sec, that takes the value of 'event' which will contain the text from my php file. So if my PHP die statement was: or die("no luck"); then the resulthandler(event) would pass on the value "no luck" to my function. You also need to specify the format of the result. In this case it is text. You can also use XML feedback for moe complex things like database functions. Anyway....
The next part is this:
<mx:request xmlns="">
<name>{fname.text}</name>
<email>{email.text}</email>
<message>{message.text}</message>
</mx:request>
</mx:HTTPService>
This basically sets the data to be transmitted to the URL specified in the first code block. In my example i have the users name, email address and their message. Basically my PHP code receives a variable named "name" containing the data from the fname text input box (this is set by the code: {fname.text} ) Now as you notice this code comes WITHIN the mx:HTTPService tag which is now ended after the mx:request tag. AS far as i know the xmlns property doesnt need to be filled in. I may be wrong but it works so far!
Now we need to define our functions that submit the form and process the feedback.
firstly you need (it seems) to import the controls form the library inside the mx:Script tag:
<mx:Script> <














