ririe44 Posted December 19, 2008 Share Posted December 19, 2008 Hey everyone... It's been a while since I've been here, but I'm excited to be back. I've created this Flash contact form, which then directs its variables to a php script (mailer.php). Anyway, I'm not getting any results, could you look through my code to check to see where I might have an error? Thanks! Flash Code: stop(); send_btn.onRelease = function() { my_vars = new LoadVars(); my_vars.sender = email_box.text; my_vars.subject = subject_box.text; my_vars.message = message_box.text; if (my_vars.sender != "" and my_vars.subject != "" and my_vars.message != "") { my_vars.sendAndLoad("mailer.php", my_vars, "POST"); gotoAndStop(2); } else { error_clip.gotoAndPlay(2); } my_vars.onLoad = function() { gotoAndStop(3); }; }; email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function () { if (error_clip._currentframe != 1) { error_clip.gotoAndPlay(6); } }; And my mailer.php code (I know it says email@email.com...): <?php // read the variables form the string, (this is not needed with some servers). $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; $sender = $_REQUEST['sender']; // include sender IP in the message. $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message; $message= $full_message; // remove the backslashes that normally appears when entering " or ' $message = stripslashes($message); $subject = stripslashes($subject); $sender = stripslashes($sender); // add a prefix in the subject line so that you know the email was sent by online form $subject = "photo ". $subject; // send the email, make sure you replace email@yourserver.com with your email address if(isset($message) and isset($subject) and isset($sender)){ mail("email@email.com", $subject, $message, "From: $sender"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/137632-flash-php-mailer/ Share on other sites More sharing options...
.josh Posted December 19, 2008 Share Posted December 19, 2008 doesn't look like anything is wrong with the php. I don't know a whole lot about AS but are you sure you are uh...damn, I don't know the term, but like for instance, if that code is inside a button, but for instance email_box.text is in some other object (like the button is inside an object of some other object or something), you would need to put the right... uh, path.to.object.email_box.text or whatever. Kind of like how _root.email_box.text would (I think) mean that that box is on the root scene or whatever. Well if it's inside an object, it would (I think) be _root.someobject.email_box.text or I guess it kind of works like directories, where you can use relative paths or somethin'. I dunno. I think I halfway know what I'm talking about. Anyways, did you check that you have the right "path"? In other words, I think if you have email_box.text in objectA and this function is in objectB those are two different scopes, and you have to specify the path so AS knows where to find it. Or something. Quote Link to comment https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-719385 Share on other sites More sharing options...
ririe44 Posted December 19, 2008 Author Share Posted December 19, 2008 No, everything is all within the same scene. I don't need any _root. or _parent. here. If the php looks good, then I'm going to further analyze the flash... cause it should work! Quote Link to comment https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-719423 Share on other sites More sharing options...
.josh Posted December 19, 2008 Share Posted December 19, 2008 Well technically you should be using $_POST['varnamehere'] in the php but $_REQUEST can be used. Could also be that the mail server on your host isn't working or not setup properly or something. Try going to www.yoursite.com/mailer.php directly, see if you get an email. If you do, then you can at least scratch that off the list. Quote Link to comment https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-719440 Share on other sites More sharing options...
zang8027 Posted January 27, 2009 Share Posted January 27, 2009 I got one working. MAke sure its uploaded to a site.. my main problem was I was trying to do it on localhost... embarrasing ha. Here is what i got for contact.php: <?php $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; if(empty($_POST['senderEmail'])){ echo"no email address found"; exit; } $senderName = $_POST['senderName']; $senderEmail = $_POST['senderEmail']; $senderMsg = nl2br($_POST['senderMsg']); $sitename = "www.tyzangmedia.com"; $to = "tyler@tyzangmedia.com"; $ToName = "Tyler"; $date = date("m/d/Y H:i:s"); $ToSubject = "Email From $senderName ($senderEmail) via $sitename"; $comments = $msgPost; $EmailBody = "A visitor to $sitename has left the following information<br /> Sent By: $senderName <br /><br /> Message Sent: <br />$senderMsg<br /><br />"; $EmailFooter = "<br />Sent: $date<br /><br />"; $Message = $EmailBody.$EmailFooter; $ok = mail($to, $ToSubject, $Message, $headers . "From:$senderName <".$to.">"); if($ok){ echo "retval=1"; }else{ echo "retval=0"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-747988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.