View Full Version : Flash/PHP email form
snowhite
04-10-2004, 01:18 AM
hey guys-
this is my first post on here, so i'm gonna try my best to not get flamed like i've seen done so often. but anyways. i've been working on getting a flash email form to be used on a website i'm doing. it involves php. i used this script
<?
$to = "you@yourdomain.com";
$msg = "$name\n\n";
$msg .= "$message\n\n";
mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");
?>
i used the script from a tutorial i downloaded a while back. the one problem, though, with this is that the site i'm using it for has more than just a message to fill in. it is several different text boxes. you can view it at the 'resumes' section of www.halo.justixdevelopment.com i don't know what to change about the php script to relate to this scenario. thanks for any guidance or help. take it easy-
johnb.
justix:development
kryptech.net
04-10-2004, 02:56 PM
the number 1 way to not get flamed: dont let your first post be a question, try to help someone out. but to be nice(and because I've been flamed) hi...
snowhite
04-10-2004, 04:44 PM
yea, i agree and totally understand, but i am quite sure that there's not much i could help anyone with in this forum. i'm just a flash user. i got into flash before i even learned much of html, so i know didly-squat save for a good bit of actionscript, otherwise i would have tried to help a few peeps before asking. thanks for not flamin me though =).
snowhite
04-10-2004, 08:52 PM
hey guys-
i got it. thanks anyways. take it easy-
johnb.
snowhite
04-11-2004, 12:00 AM
alright, i'm back. just wanted to tell what the answer was just in case anybody else came around looking for a similar solution.
well, i did a little bit more searching for a flash/php contact form tutorial or guide or whatever, and i found one that i really didn't like at all, but it shed some light on the subject, enabling me to resolve my dilemma. scroll up to see the old code i was using. here's the new one (there's a good bit more substance to it because i added quite a few variables). And, btw, i will making some of this generic, so don't take things like the $to variable literally.
<?
$to = "john@justixdevelopment.com";
$subject = "Resume from $name";
$name=$HTTP_POST_VARS ['name'];
$address=$HTTP_POST_VARS ['address'];
$city=$HTTP_POST_VARS ['city'];
$state=$HTTP_POST_VARS ['state'];
$zip=$HTTP_POST_VARS ['zip'];
$email=$HTTP_POST_VARS ['email'];
$area=$HTTP_POST_VARS ['area'];
$firstThree=$HTTP_POST_VARS ['firstThree'];
$lastFour=$HTTP_POST_VARS ['lastFour'];
$comments=$HTTP_POST_VARS ['comments'];
$msg = " Name: $name\n Address: $address \n City: $city \n State: $state \n Zip: $zip \n Email: $email \n Phone: $area-$firstThree-$lastFour \n Comments:-----------------------\n $comments\n -----------------------";
mail($to, $subject, $msg, "From: $name\nReply-To: $email\n");
?>
the main problem was that i wasn't correctly telling php how to load the variables from flash. in order to do that, you name your php variable (i.e. "$tname") and set it equal to the flash variable, but in order to do that you have to say "HTTP_POST_VARS ['name']; In flash, you set the method for the variables to "POST", which corresponds with php finding the posted variables ("POST_VARS"). So that was my core problem. If you have any other questions about the difference between the code, email me at john@justixdevelopment.com
take it easy-
johnb.
justix:development
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.