Groups | Blog | Home
all groups > flash actionscript > february 2007 >

flash actionscript : Text Input in loadVar


scholzr
2/9/2007 9:20:55 PM
OK, so I know that this is probably a VERY simple question, but I am new to
Flash, so can somebody please help? I am trying to post the contents of several
text inputs to a CGI script when the user clicks a submit button using the
following script: (I have removed the address to the actual CGI script)

on (click) {
var my_lv:LoadVars = new LoadVars();
my_lv.name = name.text;
my_lv.email = email.text;
my_lv.phone = phone.text;
my_lv.regarding = regarding.text;
my_lv.message = message.text;
my_lv.send("[cgi-url]", "_blank", "POST");
}


It was my understanding that this should post the results of each of the
inputs to the CGI page using the name specified in the script (name, email,
phone, etc) as the variable name. Is this true? If so, any ideas why my CGI
script does not recognize the variables?

Thanks
satrop
2/10/2007 2:58:54 AM
scholzr
2/13/2007 8:20:52 PM
satrop
2/13/2007 9:15:39 PM
Ok! No problem!! Hear's what the php script is gonna look like!>

<?php
$sendTo = "youraddress@thisplace.com";
$subject = "The Title Of the Email";
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message .= $_POST["change to the name of you text field var"] . "\r\n\n";
$message .= $_POST["change to the name of you text field var"] . "\r\n\n";
$message .= $_POST["change to the name of you text field var"] . "\r\n\n";
$message .= $_POST["change to the name of you text field var"] . "\r\n\n";
$message .= $_POST["change to the name of you text field var"] . "\r\n\n";

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

Ok, with is bit of code put it in the root folder in your site. Titled
"email.php" That was the easy part?! Now for the flash side>

You have to make a movie clip name it "form" into which all the varibles (the
text you want to be sent to an email address) must go. Attach this code to
your send button>

on (release) {
form.loadVariables("email.php", "POST");
}

And that should do it? If you have any problems getting it to work you can
send me your .fla file so I can have a look at it. I'll send you my email
address in a private message. Hope this helped and have a good day!
scholzr
2/14/2007 5:57:20 PM
Thanks,

I created the php file, and was able to send emails with it using a regular
html file sending the same variables as my flash, but I was not able to get my
form to submit. My form is already in it's own movie clip, so I changed the
name in the button script to match, but it does not seem to do anything when I
press the submit button. Any ideas?
AddThis Social Bookmark Button