Groups | Blog | Home
all groups > macromedia flash flash remoting > october 2005 >

macromedia flash flash remoting : Flash contact form with amfphp



NO[at]SPAM ngelina
10/8/2005 12:00:00 AM
Hello,

I'm making a contact form on my site with amfphp and I send the vars in a
loadvarsobject to php:

sendContactForm = function(_contactObj) {
this.createNetconnection();
var contactResponder = new Object();
contactResponder.objRef = this;
contactResponder.onResult = function(result) {
this.objRef.broadcastMessage("_sendContactFormResult", result);
};
this.connection.call("Project.sendContactForm", contactResponder,
_contactObj);
};


The problem is I don't seem to be able to acces the vars in PHP.

This is what I have in PHP:

function sendContactForm($email, $message, $topic)
{
$email = $_POST["email"];
$message = $_POST["message"];
$topic = $_POST["topic"];
$to = "info@myaddress.be";;
$subject ="Contact form request from myaddress.be";
if( mail($to, $subject,$message))
return "0k";
else return "Error";
}

This is what I get in the NetConnection Debugger:

Call-Project.sendContactForm({message:hello, subject:testing,
email:info@test.be, topic:request information})

MethodName: "Project.sendContactForm"
Parameters (object #2)
.....[0] (object #3)
..........email: "info@test.be";
..........message: "hello"
..........subject: "testing"
..........topic: "request information"
:frown;
NO[at]SPAM ngelina
10/8/2005 8:25:14 PM
Solved it with help from someone at flashfocus, I had to thread the object as
an associative array!


$mail = $result['topic'];
$mail .= $result['email'];
$mail .= $result['subject'];
$mail .= $result['message'];


AddThis Social Bookmark Button