Page 1 of 1

PHP code does not post client name in email...

Posted: Mon Oct 18, 2010 3:01 pm
by tinwisker
Running this in conjunction with action script. I am receiving the email with the email address, and the message, but there is no client name coming through.
Need help!

Code: Select all

<?php
//create short variable names
$clientName = $_POST['clientName'];
$email = $_POST['email'];
$message = $_POST['mess'];
//set up send mail
//enter you email address here
$sendMail = "m.fogarty@2b5.biz";
//enter your subject
$sub = "LSR Mailing List";
//this receives the message from the ActionScript
$inquiry = $message;
$extra = "From: $email\r\nReply-To: $email\r\n";
mail($sendMail,$sub,$inquiry,$extra);
//set up variable to let AS know that the mail was sent successfully
$wasSent = 1;
echo "&mailed=".$wasSent;
echo "&returnmsg=Thank you ".$clientName.". Your mail has been sent.";
?>

AC
stop();
//this ensures the input boxes are blank
emailForm_mc.clientName = "";
emailForm_mc.email = "";
emailForm_mc.message = "";


/*******************set up email form******************/
//set up function to make send button work
emailForm_mc.send_btn.onRelease = function() {
	//trace("button works");
	receiver = new LoadVars();
	receiver.onLoad = function(success) {

		//this picks up the vaiable sent from PHP that lets the action script know if the mail has been sent. If it has been sent the value returned is 1 and the form resets.
		clearForm = receiver.mailed;
		if (success) {
			//trace("i have loaded");
			emailForm_mc.returnline = receiver.returnmsg;
		}
		//this clears the form if the mail has been sent. It knows to clear because PHP returns 1 through the variable &mailed. 
		if (clearForm == 1) {
			emailForm_mc.clientName = "";
			emailForm_mc.email = "";
			emailForm_mc.message = "";
		}
	};
	sender = new LoadVars();
	sender.clientName = emailForm_mc.clientName;
	sender.email = emailForm_mc.email;
	sender.mess = emailForm_mc.message;
	sender.sendAndLoad("phpFlashEmailScript.php",receiver,"POST");
};

Re: PHP code does not post client name in email...

Posted: Mon Oct 18, 2010 5:50 pm
by twinedev
Try this to troubleshoot:

Code: Select all

$inquiry = print_r($_POST,true);
Then submit the form, may sure your action script is passing the PHP script your values you are expecting.

-GReg

Re: PHP code does not post client name in email...

Posted: Mon Oct 18, 2010 7:12 pm
by tinwisker
Were in the code do I place it?

Re: PHP code does not post client name in email...

Posted: Mon Oct 18, 2010 8:35 pm
by califdon
tinwisker wrote:Were in the code do I place it?
Anywhere you want to. All it does is print out what values are in the $_POST array so you can tell whether they are getting to your data handling script or not.

Re: PHP code does not post client name in email...

Posted: Tue Oct 19, 2010 12:52 pm
by twinedev
put it where you have:

Code: Select all

$inquiry = $message;
it does matter where you put it to e-mail you, it returns the information, it doesn't send it to the browser.

-Greg