Log in

View Full Version : Flash to PHP to email



nate51
02-10-2009, 04:23 AM
I have a form that I use for submitting data. With HTML everything works perfect, but when I use it with flash for some reason the contents submitted come to my email like this "Name: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#353C53\" LETTERSPACING=\"0\" KERNING=\"0\">John Doe</FONT></P></TEXTFORMAT>
Email: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#333333\" LETTERSPACING=\"0\" KERNING=\"0\">jdoe@hotmail.com</FONT></P></TEXTFORMAT>
Message: <TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"10\" COLOR=\"#333333\" LETTERSPACING=\"0\" KERNING=\"0\">message content&apos;s</FONT></P></TEXTFORMAT>"

Does anyone know why the emails are coming to me as HTML code?

This is the submission code in flash

on(rollOver) {
sendbtn.gotoAndPlay("over");
}
on(rollOut) {
sendbtn.gotoAndPlay("out");
}
on(press) {
form.loadVariables("email.php", "POST");
}

and if needed this is the php code that sends the data

<?php
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];

$subject = "Inquiry/Comment";

$message = "
Name: $name
Email: $email
Message: $message
";

mail("xxxx@xxxx.com", $subject, $message);

?>

I submitted this to flash as I feel it is more of a flash issue than php.

Medyman
02-10-2009, 08:35 PM
Turn off HTML parsing for the text fields.

http://livedocs.adobe.com/flex/201/langref/flash/text/TextField.html#htmlText

nate51
02-16-2009, 10:51 PM
Turn off HTML parsing for the text fields.

http://livedocs.adobe.com/flex/201/langref/flash/text/TextField.html#htmlText

Thanks for the link Medyman, I looked over the link but I still can't make sense of it. Is HTML parsing something I need to drop code in to disable? Or is it something you check off in exporting? Or is it something you set in the text parameters for the text fields?

Medyman
02-17-2009, 06:48 PM
Thanks for the link Medyman, I looked over the link but I still can't make sense of it. Is HTML parsing something I need to drop code in to disable? Or is it something you check off in exporting? Or is it something you set in the text parameters for the text fields?

It's a property of the TextField class. Paste how you're harvesting the variables (the code that gets the values from the text fields) and I'll let you know how to change it.

nate51
02-17-2009, 07:02 PM
This is the code on the mc which holds the text fields

onClipEvent(data){
// show welcome screen
_root.content_mc.contact_mc.gotoAndPlay(33);
}

Then in the mc the text fields have var names corrosponding with the php page and the "Render Text as HTML" button is off.

And last but not least this is my submit button

on(press) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
form.loadVariables("email.php", "POST");
}

*submit button is not inside the mc with the text fields.

Medyman
02-17-2009, 07:05 PM
That's all the code related to this? I doubt that. There should be some code that draws the variables out of the textfields and attaches to the "form" object.

nate51
02-17-2009, 07:10 PM
Hate to burst the bubble, but thats all the code it uses.

I got the original code from http://www.kirupa.com/developer/actionscript/flash_php_email.htm

Medyman
02-17-2009, 07:25 PM
No wonder. That's your whole problem.

Have a look at this tutorial (http://gotoandlearn.com/play?id=50) that shows the right way to link PHP & Flash.