Jump to content

Recommended Posts

Posted

Hi,

 

My name is Lily and I am new to this forum.

Since the last post was back in 2004 I decided to start new topic.

 

I have a problem making email form from flash with php to work with your server.

PHP code is:

<?

if(!empty($HTTP_POST_VARS['sender_mail']) || !empty($HTTP_POST_VARS['sender_message']) || !empty($HTTP_POST_VARS['sender_subject']) || !empty($HTTP_POST_VARS['sender_name']))

{

$to = "my email";

$subject = stripslashes($HTTP_POST_VARS['sender_subject']);

$body = stripslashes($HTTP_POST_VARS['sender_message']);

$body .= "\n\n---------------------------\n";

$body .= "Mail sent by: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";

$header = "From: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";

$header .= "Reply-To: " . $HTTP_POST_VARS['sender_name'] . " <" . $HTTP_POST_VARS['sender_mail'] . ">\n";

$header .= "X-Mailer: PHP/" . phpversion() . "\n";

$header .= "X-Priority: 1";

if(@mail($to, $subject, $body, $header))

{

echo "output=sent";

} else {

echo "output=error";

}

} else {

echo "output=error";

}

?>

 

Please let me know what line should be changed, that your server receive the email form.

Thank you so very much.

Posted

Welcome to the forums Lily.

 

$HTTP_POST_VARS was depreciated sometime ago. You need to either delcare $HTTP_POST_VARS as global or use $_POST as I have below.

 

><?
if(!empty($_POST['sender_mail']) || !empty($_POST['sender_message']) || !empty($_POST['sender_subject']) || !empty($_POST['sender_name']))
{
$to = "my email";
$subject = stripslashes($_POST['sender_subject']);
$body = stripslashes($_POST['sender_message']);
$body .= "\n\n---------------------------\n";
$body .= "Mail sent by: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";
$header = "From: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";
$header .= "Reply-To: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
} else {
echo "output=error";
}
?>

Posted

Thank you so much for fast reply! :)

I will try it now in meanwhile please let me know if I need to change anything in send button code.

Thank you in advance.

 

Here is how I call the php file from flash:

---------------------

on (release) {

// Now import the variables we

// need to send in this movie clip

sender_mail = _root.Semail.text

sender_name = _root.Sname.text

sender_subject = _root.Ssubject.text

sender_message = _root.Smessage.text

// all the vars we just imported

// will be sent via POST method now

loadVariables("sendmail.php",this,"POST");

// and when receives the answer from

// the server...

this.onData = function()

{

for(var a in this) trace([a,this[a]])

// ok, next frame

_root.nextFrame();

if(this.output=='sent')

{

// in case of success

_root.errTitle = 'Thank You.';

_root.errType = "Your message has been succesfully sent.";

} else {

// else

_root.errTitle = "Error!";

_root.errType = "Attention, an error occurred while processing your message. Please try again later.";

}

}

}

 

-----------------------------------

Posted

One more thing:

I just check on the server and cgi-bin is set to : mail.php

 

Should I change the name of my php file?

 

What doesn't work is respond from server, to get to "thank you" part .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...