send and load

_global.relRT = this;
relRT.errorMsg.text = “”;
//Trim Function – Right and Left Trim
function ltrim(matter) {
if ((matter.length>1) || (matter.length == 1 && matter.charCodeAt(0)>32 && matter.charCodeAt(0)<255)) {
i = 0;
while (i<matter.length && (matter.charCodeAt(i)<=32 || matter.charCodeAt(i)>=255)) {
i++;
}
matter = matter.substring(i);
} else {
matter = “”;
}
return matter;
}
function rtrim(matter) {
if ((matter.length>1) || (matter.length == 1 && matter.charCodeAt(0)>32 && matter.charCodeAt(0)<255)) {
i = matter.length-1;
while (i>=0 && (matter.charCodeAt(i)<=32 || matter.charCodeAt(i)>=255)) {
i–;
}
matter = matter.substring(0, i+1);
} else {
matter = “”;
}
return matter;
}
function trim(matter) {
return ltrim(rtrim(matter));
}
//Submit function
btn_Submit.onRelease = function() {
//customer info
var fname = trim(relRT.fname.text);
var lname = trim(relRT.lname.text);
var mname = trim(relRT.mname.text);
var address1 = trim(relRT.address1.text);
var address2 = trim(relRT.address2.text);
var telno = trim(relRT.telno.text);
//login information
var username = trim(relRT.username.text);
var password1 = trim(relRT.password1.text);
var confirmpassword = trim(relRT.confirmpassword.text);
if (fname eq “”) {
message = “Please input required field, enter first name.”;
} else if (lname eq “”) {
message = “Please input required field, enter last name.”;
} else if (address1 eq “”) {
message = “Please input required field, enter address1.”;
} else if (username eq “”) {
message = “Please input required field, enter username.”;
} else if (password1 eq “”) {
message = “Please input required field, enter password.”;
} else {
if (password1 eq confirmpassword) {
dat = new LoadVars();
dat.fname = fname;
dat.lname = lname;
dat.mname = mname;
dat.address1 = address1;
dat.address2 = address2;
dat.telno = telno;
dat.username = username;
dat.password1 = password1;

dat.sendAndLoad(“http://localhost/flash/insertdata.php&#8221;, dat, “POST”);
dat.onLoad = function(success:Boolean) {
if (success) {
//_root.gotoAndPlay(1);
} else {
_root.gotoAndPlay(2);
_root.clip2._visible = true;
}
};

} else {
message = “Password does not match.”;
}
}
relRT.errorMsg.text = message;
};

Advertisements
Posted in: 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s