Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : Form Processing


IMDaNuBe
1/2/2005 7:00:37 PM
Hello Forums: I have been working on a form recently, and need a nice and easy
form processing script (Preferrably PHP based). I'm having a hard time trying
to find such a script. Any advices? Thanks!
Pluda
1/2/2005 7:10:16 PM
hello,

What do you need?

an email form?

Save the form fields into one mysql table?

IMDaNuBe
1/2/2005 7:13:40 PM
Pluda
1/2/2005 7:28:47 PM
ok,

I'm posting one php code whitch you must load using the loadVars object.

This php will first check if the fields Name, Email and Message are correctly
filled, then he will send you one email whith the user comments and another
email to user thanking him for be in touch with you.

This is one simple php file, you will for sure untherstand it very well.

In flash you just need to have your textfields whith instance names name,
email and message, then using loadVars you do.

lv = new LoadVars;
lv.load("My_email.php", "lv", POST");


<?PHP
$adminaddress = "YourAdressHere";
$siteaddress ="www.YourSite.com";
$sitename = "The Name of The Site";
//
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$Required = array ("name", "email", "message");

$Ignored = array ("result","resultado","junk");

while (list($Key, $Value) = each($Required))
{
if ((empty($HTTP_POST_VARS[$Value])) &&
(empty($HTTP_GET_VARS[$Value])))
{

echo "&vars=".urlencode("You must fill in the field $Value!");

exit;
}
}

while (list($Key, $Value) = each($Ignored))
{
unset($HTTP_POST_VARS[$Value]);
unset($HTTP_GET_VARS[$Value]);
}

$body="
Name: $name

Email: $email

Message:

$message
";

$from="From: $adminaddress";

mail($adminaddress, "Form of site $sitename", $body, $from);
mail($email, "Thanks for visit the site $sitename",
"Dear $name,

Thanks for visiting us!

$sitename | $siteaddress | $adminaddress"

, $from);

echo "&vars=".urlencode("Message Sent. Thanks");

?>
IMDaNuBe
1/2/2005 7:35:30 PM
Pluda
1/2/2005 7:43:26 PM
Pluda
1/2/2005 7:47:10 PM
oh, don't forget to add one textfield in your form to display the result or
failure of the form processing like this per example

one textfield whith instance name error

and in php just chang this

echo "&error=".urlencode("You must fill in the field $Value!");

echo "&error=".urlencode("Message Sent. Thanks");
Ken Fine
1/2/2005 10:41:03 PM
What webserver are you running? IIS? Apache? What hardware?
[quoted text, click to view]

IMDaNuBe
1/2/2005 11:54:54 PM
Regarding the code:

lv = new LoadVars;
lv.load('My_email.php', 'lv', POST');

Attach Code

Pluda
1/3/2005 12:25:08 AM
Yes, on the button actions or in main timeline referencing the button instance
name like:

myBtn.onRelease = function(){
lv = new LoadVars;
lv.load("My_email.php", "lv", POST");
lv.onLoad = function (sucess){
if(sucess){
doWhatereverYouWant:
}
}
}
IMDaNuBe
1/3/2005 12:34:18 AM
Bah, it's not working. I dont' know why, it seems that all of my forms do not
work..... None of them works. I've tried like 4 - 5 different methods and it
will not post to the PHP form. What might be the cause of this?
IMDaNuBe
1/3/2005 1:03:13 AM
I'll give you my FLA file and PHP file:
http://www.xiaotunes.net/website/flash/main1.fla
http://www.xiaotunes.net/website/flash/email.php Can you possibly shed some
light for me? Please? (In the FLA File, my Contacts page is inside a movie
clip, labeled 'page5' Please help....
Pluda
1/3/2005 2:23:14 AM
Hello,

I would love to help you, but you need to help me too... :-)

Your fla has 21 Mb, this is not good!

Can you please just copy your form to one new document for me to dowload it?

Thanks!
IMDaNuBe
1/3/2005 2:40:11 AM
Sorry sir! My mistake

IMDaNuBe
1/3/2005 7:43:43 AM
Pluda
1/3/2005 10:58:22 AM
Hello, I'm realy sorry, I can't open your file, it gives error.

When sending fla's is his good practice to zip the files, ok?

Can you please do that?

Yes, I'm unther Apache, using Linux as operating system in a pentium 4/1Gb Ram
machine
IMDaNuBe
1/3/2005 5:28:11 PM
Sorry!

Pluda
1/3/2005 7:17:00 PM
ok, you're doing all wrong!

I've told you to use the lv = new LoadVars();
lv.load("email.php");

you're using lv.name = name

etc

please dowload the functional sample at

www.esquisso.com/clientes/forum/contact_form.zip

You just need to insert in php youe email adress in adminadress

It works good, I've tested here, ok?

Hope this will help you!
IMDaNuBe
1/3/2005 11:56:41 PM
Wow

Works perfect!

Pluda
1/4/2005 12:25:59 AM
you're welcome!

AddThis Social Bookmark Button