PDA

View Full Version : simple PHP form mailer in flash?


section8ight
03-06-2004, 05:41 PM
i have this php form mailer that I've used in most of my html based sites. Is there a way i could easily use the same script in flash? I've had very little experience working with server side connectivity in flash, and although I've attempted to read up on it, have had very little luck...

here is the script.. It pretty much just proccesses everything in between the <form> tags and spits it out nicely in an email. Posting the script probably isn't even relevant, as I guess im just looking to figure out how to use actionscript to connect to it..




<?PHP
$to = "help@taxdebtsolutions.com";
$subject = "Results from your Request Info form";
$headers = "From: Form Mailer";
$forward = 1;
$location = "thankyou.html";

$date = date ("l, F jS, Y");
$time = date ("h:i A");



$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);

header ("Location:$location");

?>



My guess would be to make input text boxes, name them, and then use a button to send the variables to the server. However, how i'd go about doing that is a mystery to me, thus is why im posting. Any help would be great.

mike

section8ight
03-07-2004, 02:20 PM
i guess it may be easier just to ask if there is any generic way to use any webmail script php or otherwise in flash..

CyanBlue
03-07-2004, 03:42 PM
Howdy... ;)

Well... Let me ask you this way... Judging by the look of your PHP script, you should know how to pass the Flash variable to PHP so that PHP can recognize those variables passed from the Flash, right??? (If you don't, that's where you should start looking...)

Let's say that you know that part... Then, just pass the required/necessary information from Flash to PHP and see what's going on... All the basic stuff are in your PHP script already, so it will be just tweaking the part that I have just mentioned and the PHP script should be working properly... (Not sure if that's the answer you are looking for though...)

section8ight
03-07-2004, 03:45 PM
hmm you know, i haven't had any experience with passing variables from flash to php. Is there an easy way to go about doing that? I have several form mail scripts, and they all work the same in html...

you have the opening form tag with the php or perl script.. everything inbetween is just text box or some other form of input that the user fills out, and then of course a submit button. Is there a way to do it in flash that is as easy as that?

CyanBlue
03-07-2004, 03:48 PM
Um... I don't think it is going to be THAT easy to do it in Flash...
Go check out the tutorial section of this site... I think I've seen Jesse's tutorial on emailing with the PHP which basically covers everything you need to know... :)

section8ight
03-07-2004, 03:49 PM
will do.
thanks

CyanBlue
03-07-2004, 03:59 PM
No problem... I am sure it is very minor thing you need to check/fix to get that PHP script work with Flash... and it is easy...

Go check out the tutorial and let us know if you have further question... :)

Oh, I am moving this thread to Server Side Scripting forum since it is basically PHP question...