Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

contact form causing a major headache! help!

Status
Not open for further replies.

suzisweet

Programmer
Aug 25, 2006
38
0
0
GB
Hi all,

I am having problems with a contact form I am producing in flash which uses php to send mail to a yahoo email address.

I have 5 fields :

first name - (in flash this field is 'firstname')
surname - (in flash this field is 'surname')
email - (in flash this field is 'emailad')
telephone - (in flash this field is 'phone')
message - (in flash this field is 'comment')

you can see the form at

Problem is when I check it on my yahoo mail it is only giving me the first name, email addrss and message.
This is because my script at the moment is only stipulating info for 1 name value, an email value and a message value. I dont know how to change this or add to it so that the other fields will work.
I have tried messing about with the code a little and have spent three hours on it this morning with no joy. I hope it is something fairly simple...

the question is how can I amend these scripts so that i get mail from every field instead of just the 3 which it seems to be referencing at the moment? can anyone help? my code is below :

thanks in advance and in hope!

---------------------------------------------------------

actionscript -

var receiver = new LoadVars();
receiver.onLoad = function() {
gotoAndStop(2);
};

send_btn.onRelease = function() {
var sender = new LoadVars();
sender.name = firstname.text;
sender.email = emailad.text;
sender.message = comment.text.split("\r").join("\r\n");
sender.sendAndLoad("armail.php", receiver, "POST");
};

stop();
-----------------------------------------------------------

php file -

<?php
$sendTo = "myemailaddress@yahoo.co.uk";
$subject = "message from yourdomain.com";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];


mail($sendTo, $subject, $message, $headers);
?>
 
You need to pass the extra values from flash to the php and then from the php to your email.

ACTION SCRIPT

send_btn.onRelease = function() {
var sender = new LoadVars();
sender.name = firstname.text;
sender.sur = surname.text; //added this line
sender.ph = phone.text; //added this line
sender.email = emailad.text;
sender.message = comment.text.split("\r").join("\r\n");
sender.sendAndLoad("armail.php", receiver, "POST");
};

PHP
<?php
$sendTo = "myemailaddress@yahoo.co.uk";
$subject = "message from yourdomain.com";

$headers = "From: " . $_POST["name"];
$headers .= "Surname: " . $_POST["sur"];
$headers .= "Phone: " . $_POST["ph"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];


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


Or something like that.
 
Thanks for the reply..I really appreciate it.

Im gonna give this a try will let you know how I get on.

Cheers for now..
 
Hi,

I too am having a problem with making a contact form work in yahoo. It probably does not help that this is the first php thing that I have ever tried.

Having tried other tutorials on this without success, I was encouraged by suzisweet's situation in that it seemed she was getting some results. I am not doing a name/surname thing. Just an email address, a subject matter and a message. Thus I attempted taking her script and rejuggling it according to my situation.

On the other tutorials the result was that it said the message was sent and never showed up. With this effort it just continues to say that the message is being sent.

If the scripts are OK (are they OK???) I was wondering (again my first effort with php) if the php file has to be in some specific directory in my Yahoo file manager to make this work? (When I activated PHP Manager in Yahoo it created a whole number of different, yet seemingly related, PHP directories.)

Any advice/insight on this would be greatly appreciated. Thanks.



ActionScript (AS 2.0 in Flash Pro 8):

var receiver = new LoadVars();
receiver.onLoad = function() {
gotoAndStop(2);
};
send_btn.onRelease = function() {
var sender = new LoadVars();
sender.subject = subject_box.text;
sender.email = email_box.text;
sender.message = message_box.text.split("\r").join("\r\n");
if (sender.email != "" and sender.subject != "" and sender.message != "") {
sender.sendAndLoad("armail.php", receiver, "POST");
gotoAndStop(2);
} else {
error_clip.gotoAndPlay(2);
}
sender.onLoad = function() {
gotoAndStop(3);
};
};
email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function () {
if (error_clip._currentframe != 1) {
error_clip.gotoAndPlay(6);
}
};
stop();


PHP script:

<?php
$sendTo = "seaborn.christian@gmail.com";
$subject = "message from
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];


mail($sendTo, $subject, $message, $headers);
?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top