Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

EMAIL: FLASH to PHP → Please HELP

New Here ,
Mar 10, 2011 Mar 10, 2011

HERE IS MY FLASH ACTION SCRIPT TO SEND EMAIL FOR FORM. PLEASE HELP ME TO FIND WHAT I AM DOING WRONG

[CODE]

send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void

{

if (theName.text == "" || theEmail.text == "")

{

theFeedback.text = "*Required.";

}

else

{

// Create a variable container

var allVars:URLVariables = new URLVariables();

allVars.box1 = box_1.text;

allVars.box2 = box_2.text;

allVars.box3 = box_3.text;

allVars.box4 = box_4.text;

allVars.box5 = box_5.text;

allVars.name = theName.text;

allVars.email = theEmail.text;

//Send info to url

var mailAddress:URLRequest = new URLRequest("...");

mailAddress.data = allVars;

mailAddress.method = URLRequestMethod.POST;

sendToURL(mailAddress);

theFeedback.text = "Thank you :)";

box_1.text = "";

box_2.text = "";

box_3.text = "";

box_4.text = "";

box_5.text = "";

theName.text = "";

theEmail.text = "";

}

}

[CODE]

THIS SEEMS TO BE WORKING BECAUSE I RECEIVE EMAIL BUT IT IS EMPTY (without info)

HERES THE PHP CODE

[PHP]

<?php

//Shows where to send the email.

//Shows what the subject will be in the email.

$sendTo = "...";

$subject = "Flash Reply";

//Headers to show the information sent.

$headers = " 1: " . $POST[box_1] .

$headers = " 2: " . $POST[box_2] .

$headers = " 3: " . $POST[box_3] .

$headers = " 4: " . $POST[box_4] .

$headers = " 5: " . $POST[box_5] .

$headers = " Name: " . $POST[theName] .

$headers = " Email: " . $POST[theEmail] .

// once the variables have been defined, they can be included

// in the mail function call which will send you an email

mail($sendTo, $subject, $headers);

?>

[/PHP]

WHAT AM I DOING WRONG??

Message was edited by: Günter Schenk

TOPICS
Server side applications
688
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2011 Mar 10, 2011

How about this instead:

$headers = " 1: " . $POST[box_1];

$headers .= " 2: " . $POST[box_2];

$headers .= " 3: " . $POST[box_3];

$headers .= " 4: " . $POST[box_4];

$headers .= " 5: " . $POST[box_5];

$headers .= " Name: " . $POST[theName];

$headers .= " Email: " . $POST[theEmail];

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2011 Mar 10, 2011

Ill give this a try.

Should the first one be like this

$headers = " 1: " . $POST[box_1];

or this

$headers .= " 1: " . $POST[box_1];

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2011 Mar 10, 2011

Should the first one be like this

$headers = " 1: " . $POST[box_1];

or this

$headers .= " 1: " . $POST[box_1];

The very first instance of the $headers variable only needs a regular = assignment, but all following $headers require the so-called concentration operator (.=)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2011 Mar 10, 2011

I received this in the email

1:  2:  3:  4:  5:  Name:  Email:

Not the info from the ac3 script?

THANKS. Any other ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2011 Mar 10, 2011

Ooops, I missed something: your PHP POST variables need an underscore after the dollar sign, example:

$_POST['whatever']

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2011 Mar 10, 2011

Excellant I will change that.  I missed something as well.

THIS

allVars.box1 = box_1.text;

allVars.box2 = box_2.text;

allVars.box3 = box_3.text;

allVars.box4 = box_4.text;

allVars.box5 = box_5.text;

allVars.name = theName.text;

allVars.email = theEmail.text;

in my as3 so my php should be this

$headers = " 1: " . $_POST[box1];

$headers .= " 2: " . $_POST[box2];

$headers .= " 3: " . $_POST[box3];

$headers .= " 4: " . $_POST[box4];

$headers .= " 5: " . $_POST[box5];

$headers .= " Name: " . $_POST[name];

$headers .= " Email: " . $_POST[email];

NOT THIS

$headers = " 1: " . $POST[box_1];
$headers .= " 2: " . $POST[box_2];
$headers .= " 3: " . $POST[box_3];
$headers .= " 4: " . $POST[box_4];
$headers .= " 5: " . $POST[box_5];
$headers .= " Name: " . $POST[theName];
$headers .= " Email: " . $POST[theEmail];
CORRECT.
Gee like thanks again so much for helping.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2011 Mar 10, 2011

paintedthetown wrote:

Excellant I will change that.  I missed something as well.

So we have something in common then 😉

BTW, considering the extremely basic configuration your PHP "send email" script provides, I strongly recommend to read what the PHP manual has to say about the mail function -- and it does not contain any safety precaution at all, what makes it pretty vulnerable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2011 Mar 10, 2011

Gunter ... it works now. 

Goes to show how bouncing ideas off each other develops solutions!!

Thanks so much for all your ideas and help! I hope you have the best evening ever!!! woohhooo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 10, 2011 Mar 10, 2011
LATEST

Goes to show how bouncing ideas off each other develops solutions!!

Yep, that´s the kind of interaction I like.

On a side note: I will edit your initial post, because it´s not a good idea to reveal email addresses and URLs to PHP scripts such as yours in public forums.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines