Help please! radio button to php

hi,

I’m a bit of a flash newbie when it comes to actionscript and desperately need help…

I have a form which I’ve had working fine. (I think I bought it ages ago hence the commentary throughout the AS!) I’ve now been asked to add in a radio button (2 actually but I’m starting with the one!)

I’ve added it in, nicking this component from another form I bought, seeing as already fully reskinned the first one, but in my end email I’m getting ‘undefined’ as the result.

So. Below is my Actionscript (I kept getting typos between the AS and the PHP which was causing me grief, hence me just calling my fields sequential alphabet letters.)

kkk (oops! that’s just jumped out at me!) is the radio button - essentially I have the radio button which is ‘email’ or ‘phone’ posting to a hidden input text field called kkk. I’ve had this field ‘unhidden’ so I can confirm this works in the swf, ie the field is being populated but then this is not communicating to the php.

Below the actionscript is the php.

I would be eternally grateful for any help! I’m sure it’s really obvious what I’m doing wrong to a pro…


// UPDATE V1.1
//
// INITIAL SETTINGS
//
// Set button names here
bttnClear.txt_mc.txt.text = "";
bttnSend.txt_mc.txt.text = "";
// Set tab indexing here
fieldaaa.field.tabIndex = 1;
fieldbbb.field.tabIndex = 2;
fieldccc.field.tabIndex = 3;
fieldddd.field.tabIndex = 4;
fieldeee.field.tabIndex = 5;
fieldfff.field.tabIndex = 6;
fieldggg.field.tabIndex = 7;
fieldhhh.field.tabIndex = 8;
emailMethod.tabIndex = 9;
phoneMethod.tabIndex = 10;
fieldiii.field.tabIndex = 11;
fieldjjj.field.tabIndex = 12;
//
// DEFAULT SETTINGS
//
var sendVars:LoadVars = new LoadVars(this);
var statusVars:LoadVars = new LoadVars(this);
bgSelected = "";



//Contact Method Radio Button Component Code
var objRadioListener2:Object = new Object();
objRadioListener2.click = function(evt_obj:Object){
	kkk.text = ContactMethod.selection.data; //Records the customers selection in an empty hidden text field
}
ContactMethod.addEventListener("click", objRadioListener2);

//
// BUTTON FUNCTIONS
//
bttnClear.bttn.onPress = function() {
	clearForm();
};
bttnSend.bttn.onPress = function() {
	checkForm();
};










//
// SET FOCUS FIELDS
//
fieldaaa.field.onSetFocus = function() {
	bgSelected = this._parent._name;
	if (this.text == "") {
		this.text = "";
	}
};
fieldbbb.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldccc.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldddd.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldeee.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldfff.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldggg.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldhhh.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldiii.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldjjj.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
fieldkkk.field.onSetFocus = function() {
	bgSelected = this._parent._name;
};
//
// KILL FOCUS FIELDS
//
fieldaaa.field.onKillFocus = function() {
	bgSelected = "";
};
fieldbbb.field.onKillFocus = function() {
	bgSelected = "";
};
fieldccc.field.onKillFocus = function() {
	bgSelected = "";
};
fieldddd.field.onKillFocus = function() {
	bgSelected = "";
};
fieldeee.field.onKillFocus = function() {
	bgSelected = "";
};
fieldfff.field.onKillFocus = function() {
	bgSelected = "";
};
fieldggg.field.onKillFocus = function() {
	bgSelected = "";
};
fieldhhh.field.onKillFocus = function() {
	bgSelected = "";
};
fieldiii.field.onKillFocus = function() {
	bgSelected = "";
};
fieldjjj.field.onKillFocus = function() {
	bgSelected = "";
};
fieldkkk.field.onKillFocus = function() {
	bgSelected = "";
};
//
// CLEAR FORM
//
clearForm = function () {
	fieldaaa.field.text = "";
	fieldbbb.field.text = "";
	fieldccc.field.text = "";
	fieldddd.field.text = "";
	fieldeee.field.text = "";
	fieldfff.field.text = "";
	fieldggg.field.text = "";
	fieldhhh.field.text = "";
	fieldiii.field.text = "";
	fieldjjj.field.text = "";
	fieldkkk.field.text = "";
};
//
// CLEAR STATUS MESSAGE
//
clearStatusInt = function () {
	statusMsg.text = "";
	clearInterval(clearStatus);
};
//
// CHECK FORM
//
checkForm = function () {
	// Check fields
	i = 0;
	if (fieldaaa.field.text == "" or fieldaaa.field.text == "") {
		fieldaaa.field.text = "";
		i++;
	}
//	if ((fieldb.field.text == "") or (fieldEmail.field.text == "Please type your email") or (fieldEmail.field.text.indexOf("@", 0) == -1) or (fieldEmail.field.text.indexOf('.', 0) == -1)) {
//		fieldb.field.text = "Please type your email";
//		i++;
//	}
//	if (fieldMsg.field.text == "" or fieldMsg.field.text == "Please type your message") {
//		fieldMsg.field.text = "Please type your message";
//		i++;
//	}
	// Submit form if fields valid           
	if (i == 0) {
		sendVars.aaa = fieldaaa.field.text;
		sendVars.bbb = fieldbbb.field.text;
		sendVars.ccc = fieldccc.field.text;
		sendVars.ddd = fieldeee.field.text;
		sendVars.eee = fieldeee.field.text;
		sendVars.fff = fieldfff.field.text;
		sendVars.ggg = fieldggg.field.text;
		sendVars.hhh = fieldhhh.field.text;
		sendVars.iii = fieldiii.field.text;
		sendVars.jjj = fieldjjj.field.text;
		sendVars.kkk = kkk.text;
		sendVars.sendAndLoad("php/formSubmit.php", statusVars, "GET");
		statusMsg.text = "Sending...";
		statusVars.onLoad = function(success:Boolean) {
			if (success) {
				if (statusVars.sent == "success") {
					clearForm();
					statusMsg.text = "Thank you, your RSVP has been registered";
				}
			} else {
				statusMsg.text = "PHP error!";
			}
			clearInterval(clearStatus)
			clearStatus = setInterval(clearStatusInt, 10000);
		};
	}
};
<?php

$sendTo = "myemail@mydomain.com";
$aaa = $_GET['aaa'];
$bbb = $_GET['bbb'];
$subject = 'Wedding RSVP';
$ccc = $_GET['ccc'];
$ddd = $_GET['ddd'];
$eee = $_GET['eee'];
$fff = $_GET['fff'];
$ggg = $_GET['ggg'];
$hhh = $_GET['hhh'];
$iii = $_GET['iii'];
$jjj = $_GET['jjj'];
$kkk = $_GET['kkk'];


$headers  = "From: $RSVPwedding  
";
//$headers .= 'MIME-Version: 1.0' . "
";
//$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$msg = 
"
Guest 1: ".$aaa."



Guest 2: ".$bbb."



Guest 3: ".$ccc."



Guest 4: ".$ddd."



Guest 5: ".$eee."



Guest 6: ".$fff."



Guest 7: ".$ggg."



Guest 8: ".$hhh."



Dietary Requirements: ".$iii."



Additional comments: ".$jjj."



Preferred Contact: ".$kkk." 
";
mail($sendTo, $subject, $msg, $headers);

echo "sent=success";

?>