-
Please edit my script
I am trying to do what seems like a simple email from flash using PHP. I have a bunch of text fields, the send button checks to see if everything has been filled out and then goes to a PHP script to actually send the email.
Everything works until I hit "send" and then it just seems not to communicate with the script. The email status doesn't change and no email is sent.This is the code I have right now:
Code:
<?
$ToEmail = "[email protected]";
$ToName = "Creative Director, Joel Marsh";
$ToSubject = "Website Inquiry";
$EmailBody = "Sent By: $FormName\nSenders Email: $FormEmail\nSenders FormSite: $Company\n\n Message Sent:\n$FormComments\n\n";
$EmailFooter="\nThis message was sent by: $FormName .\n If you feel that you recieved this e-mail by accident please contact us at www.TheHipperElement.com";
$Message = $EmailBody.$EmailFooter;
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FirstName." <".$Email.">");
Print "_level0.EmailStatus='Thank You.'";
?>
What do you think? It's in the same directory as the swf running the code.
Thanks.
-
It sounds like an AS error. Post the AS and I'll take a look.....
-
Hi,
it more sounds like a php problem - most servers these days require to pick up the data with code like
$FormName = $_POST['FormName'];
$FormEmail = $_POST['FormEmail'];
Also, some mailers prefer a plain $ToMail instead of the $ToName." <".$ToEmail.">" construct.
If this does not help, please post url of the actual swf file for testing
Musicman
-
Thanks for the replies, but I think I'm with you Musicman, the actionscript works in isolation, so I'm thinking it works well...for now.
I'm relatively experienced in Flash but new to PHP, could you elaborate on what you were saying? My code is straight out of a tutorial and then edited...so a little explanation would go a long way with me.
Thanks for your help.
-
Hi,
you are using a tutorial that is pretty old - there is a successor at www.flash-db.com
Some time ago (see the "php not working" thread near the top of the page) the behaviour of php was changed for security reasons. There are still very few hosts setting compatibility to the old model, though.
Before that change, any data received from the web automatically became a php variable; today all variables that are wanted need to be explicitly received. [Consider a discussion forum that sets a variable $admin when the person logging in is recognized as admin but nothing is done otherwise, and an intruder that just adds admin=1 to data sent from the browser]
The revised tutorial will show a similar change on the AS side: sending only variables meaningful to the email script - where the old one typically would add last preloader percentage and similar things to the data
Musicman