I am trying to finish get a form to send an email. I have read/studied the lesson on this site, but still have a problem.
I have mc called formTest. On frame 1 inside I have the following AS - I have removed all formatting script. I create the text fields dynamically
stop();
var senderMessage:String;
var fieldNames:Array = new Array("fullName","phone","email","ask");
for (var i:Number=0;i<4;i++){
this.createTextField(fieldNames*,this.getNextHighestDepth(),100,10+i*30,200,22);
if (i==0){
... formatting
}
... formatting
}
...formatti9ng
}
This movie clip is then put onto the main time line, frame 1 of which has this as
testForm.sendEmail_btn.onRelease = function():Void{
message = testForm.ask.text;
testForm.loadVariables("sendmail.php", "POST");
trace (message); //produces what ever is typed into the box message
}
sendmail.php looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<h1>Hello</h1>
<?php
echo 'You are in the sendmail.php file';
$sendTo = "[EMAIL="edward@ee-web.co.uk"]...[/EMAIL]";
$subject = "My Flash site reply";
$headers = "From: [EMAIL="edward@eldon.gotadsl.co.uk"]...[/EMAIL]";
//fullName","phone","email","ask
$message = 'here is the message';
$message .= $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>
</body>
</html>
When the send button is pressed an email is delivered, but $_POST[‘message’] appears to be empty.
I have put
onClipEvent(data){
trace("message="+message);
}
onto the mc formTest. This prints out “message=undefined”
I am doing something wrong with sending the varaibles from the form.
Could someone please help me see what!
Thanks
E