Embeding a server-side script in flash

Hi!
i found ure email form php code.

<?
$recipient = "fake@fake.com";
unset($HTTP_POST_VARS['onLoad']);
unset($HTTP_POST_VARS['clear']);
$body = "The following information was submitted...

";
foreach($HTTP_POST_VARS as $key => $value) {
    $key = substr($key, 0, -4);
    $body .= "$key: $value
";
}
$from = $HTTP_POST_VARS['name_txt'] . " <" . $HTTP_POST_VARS['email_txt'] . ">";
mail($recipient, $HTTP_POST_VARS['subject_txt'], $body, "From: $from");
?>


but i dont know how to use it on FLASH, can u explain me a little, i need some dynamic text fields?

thanks in advance.

Note: if anyone else knows, help me :slight_smile:

anyone? :-\

I’m not sure but I think you need some dynamic text fields!
With variable names “name_txt”, “email_txt” and “subject_txt”.
And to use it with flash simply add a this code on the first frameof yur movie.
loadVariables(“myphpfile.php”, POST);
change myphpfile.php to the name of the php file you have!
Should werk! :-\

welllllll here’s another php code for sending mail… I understand this one better…

<?
$ToEmail = "*youremailaddresshere*";

##$ToName = "*your name/nickname*";
$ToSubject = "*Your subject here*";

$EmailBody = "Sent By: $name
Email: $email
WebSite: $website

Message:
$comments
";

$EmailFooter="
This message was sent by: $name from http://yousite or sumthin";

$Message = $EmailBody.$EmailFooter;

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FirstName." <".$Email.">");


Print "yourdynamictextbox=Complete - Your mail has been sent";

?>

You should change the things in Italic. (Your email, name etc)
And “email”, “website”, “comments” next to “EmailBody” are the variable names of the textboxes! you could add, delete, change them any way you want
and the last one “yourdynamictextbox”. That should be the textbox where it displays the text “Complete - your…” Just for the visitor to see that the mail has been sent. But If you don’t wan ti you could just delete that line!
:slight_smile:

thanks syko but how do i implement the code in flash…

i add dynamic boxes and give them the VAR names of the php code?

Thanks!

Also, is that all the code u need?
u dont need to specify the SMTP or something?
Does flash have a built in mailer?

:*(

well… that’s all you need!
just make textboxes with variable names
“name”, “email”, “website”, “comments”
.
You can change the layout of the email message.
Change the line that starts with “EmailBody=”


 <----- this is a line break

This layout would appear like this:
[ isf the name was “Syko”, website was “www.sss.ss” and comments were “mycomments here” and email was “myemail@email.com

Sent by:Syko
Email: myemail@email.com
WebSite: www.sss.ss

Message:
mycomments here

This message was sent by Syko from www.sss.ss

the last piece “thi message was sent by…” Is the next line that starts with"EmailFooter"
“$” in php means that the word followed by it is a variable! like a varibale name of a text box for example

You the man!!!

thats all i need to know.

Thanks!

:o someone change the title :stuck_out_tongue:

ok i made everything, i got the form in FLASH,

but the button is not working can you help me?


on (release) {
 if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
 gracias = "Email Incorrecto";
 }
 else if (!FirstName.length) {
 gracias = "Escribe un Nombre";
 }
 else if (!ToComments.length) {
 gracias = "Escribe un Mensaje";
 }
 else {
 loadVariablesNum ("/scripts/solicitud.php", "0", "Post");
 gracias = "Enviando su solicitud...";
 }
}

thats the code. i put it in the button, but nothing happens

maybe that code is not compatible with MX?

i have the form at my site www.zonahost.net
is at the bottom. of the page.

when u click the btn nothing happens.

:*(

can anyone help me here. Thanks.

humh… it should werk! Make sure you upload it before testing and check if your server supports php!

yep and yep…

i upload it and the server supports php.

What else could be the prob?

and its uploaded, check in zonahost.net
Enter and at the botton is the form.

:o and also, the button at flash dosent work, the AS that are supposed to work in flash dosent work.

I´ve seen your PM, but server-side thangs is not my strong side.
[SIZE=1]not even my weak side, even the weak I know sumthing about.:P[/SIZE]

=)

:o

Ok thanks!

:D:D

now everything is working fine but the script stays at

Sending email…

Do you think this is something in the server?

Well, thats what you wrote in your script, try loading the output into flash, then define an onLoad to check if that output is success, after that report to the user that the email had been sent succesfully. You should use LoadVars object, not loadVariables. If ur using flash 5, check the XML Object.

h88 8]

hmh… haven’t purchased my own domain with php yet. Can’t test it! gonna buy one soon and put my homepage up!!