Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > Server-Side Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-24-2005, 05:21 AM   #1
primablinki
Registered User
 
Join Date: Mar 2005
Posts: 15
Default PHP email form doesn't work even straight from a tutorial

Hi,

I wanted to implement a php email form in my site but I am having trouble getting the php to work. I tried files from a lot of tutorials and I didn't change any code except send to my own email address. my web server can send email through php just fine because I test it out using a form build in HTML and PHP and it sends. But then when use in Flash it doesn't send. all that is in the status bar is waiting for www.mydomain.com..
the button works fine because the flash does go to the second frame after I pressed the button. so I can't figure out what the problem is. Please help!
thanks so much.
primablinki is offline   Reply With Quote
Old 03-24-2005, 05:27 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Howdy and Welcome...

I think I remember somebody saying the same thing but I cannot find the thread...

Maybe you should post what you have so that people can see and help you...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-24-2005, 06:57 AM   #3
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

try this thread:
http://actionscripts.org/forums/showthread.php3?t=66068
it should help.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 03-24-2005, 08:03 AM   #4
primablinki
Registered User
 
Join Date: Mar 2005
Posts: 15
Default

thanks guys for the fast response.

as to post files i don't really know what to post since i test out more than 10 different tutorials and the one on actionscript.org too. i simply change the email address to my address. i also read almost all the posts i can find on this forum and on other forums but other people have a more obvious problem such as they get a email with nothing in it or the flash just said error. for me it saids the mail has been sent but it actually hasn't. at the bottom it saids its transfering data but it's still transfering data after 10 minutes. and thanks jordan for the post i also tried the code they put there but it still got me the same result. so i have no idea what the problem is, if it is my Flash or my server. but it worked when i test it using a php mail form + HTML so my web server should be working fine. any ideas? please thanks
primablinki is offline   Reply With Quote
Old 03-24-2005, 11:29 AM   #5
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Well... I do understand you have tried multiple version, but you've got to find one copy that you like most and post it whether it is from the AS.org or somewhere else so that we can actually see that... I am saying that because I think your problem lies in the Flash rather than the PHP code, but it won't hurt to show us all the codes...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-24-2005, 05:20 PM   #6
primablinki
Registered User
 
Join Date: Mar 2005
Posts: 15
Default

ok i guess ur right

here's the code, in the main timeline:
stop();
function lineAdapt() {
message_send = message;
while (msg_count<length(message)) {
msg_count = msg_count+1;
if ((substring(message_send, msg_count, 2)) eq "\r") {
message_send = (substring(message_send, 1, msg_count-2)) add "\n" add (substring(message_send, msg_count+2, (length(message_send))-msg_count+2));
}
}
message = message_send;
delete msg_count;
delete message_send;
}

and this is at the send btn:
on (release) {
if (subject eq "" or message eq "" or from eq "") {
stop();
} else {
lineAdapt();
loadVariablesNum("mail.php", 0, "POST");
gotoAndStop(2);
}
}

this is the php code:
<?php
mail("[email protected]", $subject, $registrationData, "From: PHPMailer\nReply-To: $from\nX-Mailer: PHP/" . phpversion());
?>

i also really like this other one, but i only found one code in the flash and is this:
on (release) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
form.loadVariables("email.php", "POST");
}

this is the php code for it:
$sendTo = "[email protected]";
$subject = "My Flash site reply";

$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];

mail($sendTo, $subject, $message, $headers);

?>

thanks a lot!
primablinki is offline   Reply With Quote
Old 03-24-2005, 05:34 PM   #7
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Try this thread... I think this thread should be able to help you fix the problem...
If not, search the forum with 'lineAdapt' and you will get more threads that talks about similar problems...

http://www.actionscript.org/forums/s...ight=lineAdapt
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-24-2005, 08:47 PM   #8
primablinki
Registered User
 
Join Date: Mar 2005
Posts: 15
Default

thanks for the link to that post..dunno why i didn't came across that before

i tried out every single code in that post..this is my progress

for mail.php here is the code
<?php
$emailTo = "[email protected]" ;
$name = $POST ['name' ];
$email = $POST ['email' ];
$message = $POST ['message' ];

$headers = "From:PHPMailer \r\n Reply-To:".$POST ['email' ]." \r\n X-Mailer:PHP/ \r\n MIME-Version:1.0 \r\n Content-type:text/html;charset=iso-8859-1" ;
$msg = "" ;
$msg .= $_POST['name'] . "<BR>" ;
$msg .= $_POST['email'] . "<BR>" ;
$msg .= $_POST['message'] . "<BR>" ;
if( mail ($emailTo , $_POST['name'] , $msg , $headers )){
print "&status=okay" ;
}
else{
print "&status=error" ;
}
?>

and for the submit button here is the code:
on (release) {
if (message eq "" or name eq "")
{
stop();
}
else
{
lineAdapt();
myVars = new LoadVars();
myVars.message = message;
myVars.name = name;
myVars.email = email;
myVars.send("mail.php", "_blank", "POST");
gotoAndPlay(2);
}
}
after i upload it the status bar at the bottom of the browser said Done but I still didn't receive any emails.

I also try putting the loadVars one in my button:
on (release) {
if (message eq "" or name eq "")
{
setProperty("_root.contentHolder.errorWindow", _visible, true);
stop();
}
else
{
lineAdapt();
myVars = new LoadVars();
retVars = new LoadVars();
myVars.message = message;
myVars.name = name;
myVars.email = email;
myVars.sendAndLoad("mail.php", retVars, "POST");
retVars.onLoad = function(s) {
if(s) {
if(this.status == "okay") {
gotoAndPlay(2);
}
else {
gotoAndPlay(3);
}
}
}
}
}
but it didn't send at all. maybe it's how the files are constructed that's different so it doesn't work? i am sorry im completed new when it comes to PHP. i'll upload the files too. please help me thanks so much!
Attached Files
File Type: zip mailer.zip (5.1 KB, 225 views)
primablinki is offline   Reply With Quote
Old 03-24-2005, 09:14 PM   #9
mmm..pi..3.14..
/(bb|[^b]{2})/
 
mmm..pi..3.14..'s Avatar
 
Join Date: May 2004
Location: Denver, CO
Posts: 2,740
Default

Replace the code in your button in flash with this:

ActionScript Code:
on (release) {     if (message eq "" or name eq "") {         stop();     } else {         myVars = new LoadVars();         myVars.message = message;         myVars.name = name;         myVars.email = email;         myVars.onLoad = function(ok) {             if (ok) {                 trace("Done");             } else {                 trace("Error connecting to server");             }         };         myVars.sendAndLoad("mail.php", myVars, "POST");     } }

Replace the script in your PHP file with this:

PHP Code:
<?php
$ADMIN 
"[email protected]";
$NAME $_POST['name'];
$EMAIL $_POST['email'];
$MESSAGE $_POST['message'];

$HEADER "From: $EMAIL\n";
$HEADER .= "Reply-To: $EMAIL\n";
$HEADER .= "Content-type: text/html\n\n";

$MSG "";
$MSG .= $NAME "<br>";
$MSG .= $EMAIL "<br>";
$MSG .= $MESSAGE "<br>";

$SEND mail($ADMIN $NAME $MSG $HEADER);
?>
I tested it out and it worked perfect, the only bug I found was that it would send the email but return false, so flash would always say there was an error sending the email even though there wasn't.

Eric
__________________
Eric Hainer
Unleaded Software
970.581.3387
Email: Eric followed by the AT symbol, unleaded software (one word) DOT com
Denver Web Design
mmm..pi..3.14.. is offline   Reply With Quote
Old 03-24-2005, 09:29 PM   #10
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

You could add 'echo("rtn=done");' after the mail() line and that might get rid of the error in Flash...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:28 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.