PHP Flash Form-Mail Tutorial

Ok: SHUGA! I got yours to work. The problem was in your first line.


<?
$msg = "E-mail sent from <a href="http://www.aaronsleeper.com

" target="_blank">www.aaronsleeper.com

</a>";

that is what you had, you should have this instead:


<?
$msg = "E-mail sent from <a href=\"http://www.aaronsleeper.com

\" target=\"_blank\">www.aaronsleeper.com

</a>";

You didn’t escape your quotation marks. If you want the actual code to show " you have to type in " with that back-slash.

:slight_smile:

Now I am working on the other yours jayseeme

ok, jayseemee, I couldn’t view your SWF file. It said that it was protected, so no luck there. If you could, please post the code you are using for your PHP file, and the code that you are using for your Flash file, and I’ll be able to debug it that way.

im not sure how to do this thingy but i’ll try

thanx jubba! forgot that, in my mindless search for the answers, i totally forgot to say thanx for your time and patientce w/ me.
jayemsee

either +



<?PHP
$to = "you@yourdomain.com";
$msg = "$name

";
$msg .= "$phone

"; 
$msg .= "$email

"; 
$msg .= "$comment

"; 
mail($to, $subject, $msg, "From: My web site
Reply-To: $email
");
?> 


or +



<?PHP
$TO= $_POST['jayemsee.com'];
$Name = $_POST['name'];
$Email = $_POST['email'];
$Message = $_POST['message'];
$Subject = "Test E-mail Tutorial";
$Header = "From: $Name <$Email>";


//Performing Mail script...
mail($Email, $Subject, $Message, $Header);

?>


ish? mabye? or totally wrong?! lol

Your PHP script should look like this:


<?
$to = "PUT Your E-mail Address Here";
$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$question = $_POST['question'];
$subject = "Question Form";

$message = "$question 
";
$message .= "From $name <$email> 
";
$message .= "Company: $company 
";

$header = "From: $name <$email>";

mail($to, $subject, $message, $header);
?>

that code should be placed in the file called “form.php” and that file should be placed in the same folder as your “email.swf”

Hope that works. :slight_smile:

*Originally posted by jayemsee *
**thanx jubba! forgot that, in my mindless search for the answers, i totally forgot to say thanx for your time and patientce w/ me.
jayemsee **

No problem. I only hope that my answers help you.

thanx for the promtness,and help again, imma try now? let ya know what happens ina sec!

you tha man? it works i may hafta tweak i think the way it comes out in the e-mail form itself, but all in all i’ll save it as is to refer back to! thanx again man!

@#&$^@)#$_@#$^* mine’s still not working … can you post the php code from the file … the whole thing jubba … b/c i don’t see a line like that in my code that i have

the forum changes my code … so i’ll post the php file

file

follow the tutorial for the flash version at the beginning of this thread, and the form.php is below, adjust to your liking!


<?
$to = "you@yourdomain.com";
$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$question = $_POST['question'];
$subject = "contact.form";
$Today 	= (date ("l dS of F Y ( h:i:s A )",time()));

$message = "$Today 
";
$message .= " - message result of contact form - 

";
$message .= " - sender : 
";
$message .= "[ $name ($email) ] 
";
$message .= " - company : 
";
$message .= "( $company ) 
";
$message .= "-------------------------------------------------------- 

";
$message .= "$question 
";

$header = "from: $name ($email)";

mail($to, $subject, $message, $header);
?>

a little modification! lol this is what i have saved as “FORM.PHP” following the same tutorial (1st post)!
i added xtra $message fields to help break up the text the way i want it, you can re-arrange anyway you want, the only thing i found out is see

 $message = "$Today 
"; 

see how there’s no period before the “=” sign your very first line has no period, every other line under that has one!

$Today gets todays date and time, and that’s about it.
o the flash variables are as follows if your to lazy to skip back 2 pages (lol)


on (release) {
if (name eq "" or phone eq "" or email eq "" or comment eq "") {
stop ();
} else {
loadVariablesNum ("form.php", 0, "POST");
gotoAndStop (2);
}
}

anyway hope this helps
jayemsee
www.jayemsee.com!

Ok shuga, this script worked for me:


<?
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$message = $_POST['message'];

$msg = "E-mail sent from www.aaronsleeper.com

";
$msg .= "From Name:    ".$name."
";
$msg .= "From E-Mail:  ".$email."
";
$msg .= "Telephone:    ".$phone."

";
$msg .= "Subject:	   ".$subject."

";
$msg .= "Message:      ".$message."

";

$to = "jubba@livetoskateboard.com";
$subject = "aaronsleeper.com - ".$subject;

$mailheaders .= "Reply-To: $email";

$result = mail($to, $subject, $msg, $mailheaders);
?> 


just change the $to because I sent it to myself. :slight_smile:

And remember, I am drunk. :slight_smile: :stuck_out_tongue:

I hope it works. If not then check with your host. :slight_smile: HOpe it helps.

*Originally posted by jayemsee *
**you tha man? it works i may hafta tweak i think the way it comes out in the e-mail form itself, but all in all i’ll save it as is to refer back to! thanx again man! **

I’m glad I could help :slight_smile: If you ever need PHP help let me know. The more I help, the more I learn. :slight_smile:

Yeah! Milwalkee Best Ice! The cheapest beer ever…

i think it might be that it looks like you’ve saved your file as a txt. Make sure you have a copy that is .php or it wont work

in my flash movie, can i have it call form.php and lets say response.php, but the response.php would take the e-mail he entered, and put it into the $to field and the $message could be like thanx for submitting to “blah” i will be in touch shortly etc.?
jayemsee

yes you can. in your flash movie under where
loadvariables (form.php, 0, POST) write
loadvariables (response.php, 0, POST) and instead of filling in your e-mail address put in $email or whatever your calling their email field (email, e-mail, e_mail) and in the $message = you can put somthing like

thanx $name for your submission to “_blank” i will contact you shortly

jayemsee

jubba … i copied and pasted and uploaded your code with my email addy … and here is what the email returns to me

E-mail sent from www.aaronsleeper.com

From Name:
From E-Mail:
Telephone:

Subject:

Message:

it sends the field names specified in the PHP but none of the values that have been entered for them

---------------------------edit---------------------------
i’ve now tried both scripts from you jubba and from you jayemsee … both to no avail. the PHP file is still only returning the information i put in the quote above :frowning:

well that means that your PHP code is working, but for some reason its not recieving the variables, or the problem more likely lies on the Flash side… I’ll take a look…

shuga…

now oyu hafta ga back into flash and change the vatiable names on the “input” text i.e.

you have everythong set up the way you wany it the fields that are input text boxes MUST be the same name as the actions in php …example

the first part of the php set’s up the codes variables

<?
$name = $_POST[‘name’];
( input text variable name in flash = name

$email = $_POST[‘email’];
( input text variable name in flash = email

$phone = $_POST[‘phone’];
( input text variable name in flash = phone

hope this helps
jayemsee