Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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];
Copy link to clipboard
Copied
Ill give this a try.
Should the first one be like this
$headers = " 1: " . $POST[box_1];
or this
$headers .= " 1: " . $POST[box_1];
Copy link to clipboard
Copied
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 (.=)
Copy link to clipboard
Copied
I received this in the email
1: 2: 3: 4: 5: Name: Email:
Not the info from the ac3 script?
THANKS. Any other ideas?
Copy link to clipboard
Copied
Ooops, I missed something: your PHP POST variables need an underscore after the dollar sign, example:
$_POST['whatever']
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now