Jump to content

Recommended Posts

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");
}

?>

Link to comment
https://forums.phpfreaks.com/topic/137632-flash-php-mailer/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-719385
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-719440
Share on other sites

  • 1 month later...

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";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/137632-flash-php-mailer/#findComment-747988
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.