Groups | Blog | Home
all groups > flash actionscript > december 2006 >

flash actionscript : email Script for php5


LSNsaltlamp
12/21/2006 10:45:52 PM
I was running a basic form with Flash 8 and PHP 4.*.* so that customers could
email a client of mine. My clients web hoster has since upgraded to PHP 5.2.0
and the form has quit working. Does anyone know what changed in the new version
that would affect this script?



<?php
$to = 'someone@web.com';
$subject = 'Subject Line';

$message = 'From: '.$_POST['from']."\n\n";
$message .= 'Email: '.$_POST['email']."\n\n";
$message .= 'Address: '.$_POST['snail']."\n\n";
$message .= 'Phone: '.$_POST['phone']."\n\n";
$message .= 'Comments: '.$_POST['comments'];

$additionalHeaders = "From: Flash feedback<feedback@example.com>\n";
$additionalHeaders .= "Reply-To: $_POST[email]";

$OK = mail($to, $subject, $message, $additionalHeaders);

if ($OK) {
echo 'sent=OK';
}
else {
echo 'sent=failed&reason='. urlencode('There seems to be a problem with the
server. Please try later.');
}
?>
Marghoob Sulemaan
12/22/2006 4:46:44 AM
ggshow
12/22/2006 5:22:43 AM
[q][i]Originally posted by: [b][b]LSNsaltlamp[/b][/b][/i]
I was running a basic form with Flash 8 and PHP 4.*.* so that customers could
email a client of mine. My clients web hoster has since upgraded to PHP 5.2.0
and the form has quit working. Does anyone know what changed in the new version
that would affect this script?[/q]

that means the form was running properly before they upgrade?
what type of error you get? or just nothing?

may be the php configuration, refer: http://www.php.net/mail


LSNsaltlamp
12/23/2006 12:00:00 AM
Metro Media
12/23/2006 12:00:00 AM
I am guessing that it is in the script passing variables from flash to php that
is having problems... since the variables are not being passed the mail script
cant be executed... post the other scripts involved so we can take a look
LSNsaltlamp
12/27/2006 12:00:00 AM
The other script worked fine on the older version of PHP. I've used these exact
two files (PHP and SWF) on another server and they work. Something changed with
PHP 5.2.

function checkForm():Boolean {
var missing:Boolean = false;
error1_txt.text =
error2_txt.text=error3_txt.text=error4_txt.text=error5_txt.text="";
if (name_txt.text == "") {
error1_txt.text = "*";
missing = true;
}
if (email_txt.text.indexOf("@") == -1) {
error2_txt.text = "*";
missing = true;
}
if (subject_txt.text == "") {
error3_txt.text = "*";
missing = true;
}
if (comments_txt.text == "") {
error4_txt.text = "*";
missing = true;
}
if (hear.selectedItem.label == "") {
error5_txt.text = "*";
missing = true;
}
return missing ? false : true;
}
function sendMessage():Void {
var formOK:Boolean = checkForm();
if (formOK) {
message.from = name_txt.text;
message.email = email_txt.text;
message.subject = subject_txt.text;
message.comments = comments_txt.text;
message.school = school_txt.text;
message.hear = hear.selectedItem.label;
message.sendAndLoad("email.php?ck="+new Date().getTime(), messageSent);
gotoAndStop("sending");
}
}
function backToForm():Void {
gotoAndStop("theForm");
}
var message:LoadVars = new LoadVars();
var messageSent:LoadVars = new LoadVars();
messageSent.onLoad = function() {
if (this.sent == "OK") {
gotoAndStop("acknowledge");
} else {
gotoAndStop("failure");
failure_txt.text = this.reason;
}
};
gotoAndStop("theForm");
AddThis Social Bookmark Button