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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinwisker
Forum Newbie
Posts: 5
Joined: Sun Oct 17, 2010 7:01 pm

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

Post 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");
};
Last edited by Benjamin on Mon Oct 18, 2010 3:02 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

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

Post 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
tinwisker
Forum Newbie
Posts: 5
Joined: Sun Oct 17, 2010 7:01 pm

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

Post by tinwisker »

Were in the code do I place it?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

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

Post 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.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

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

Post 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
Post Reply