Submitting a Flex form using PHP
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml” layout=”absolute”> <mx:HTTPService id=”srv” url=”http://www.rudysportfolio.com/flexTest/mail.php” method=”POST”> <mx:request> <user>{user.text}</user> <email>{email.text}</email> <message>{message.text}</message> </mx:request> </mx:HTTPService> <mx:Form> <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=”srv.send()”/> </mx:FormItem> </mx:Form> </mx:Application>
and my php file:
<?php
$address = “rugu87@hotmail.com”;
$subject = “subject line tester”;
$body = $_POST[’user’] . ” had this to say:\n” . stripslashes($_POST[’message’]);
$extra_header_str = “From:” . $_POST[’email’];
$mailsend = mail($address,$subject,$body,$extra_header_str);
echo $mailsend;
?>