-
php email form problem
Hi,
I have some script for an email newsletter signup form in a flash site. The user inputs an email address into an input text field with variable name "emailAdd", hits a submit button, and flash runs a simple email validation check before sending the email to a php file. I've used this code successfully before, and it works perfectly in Flash 7, so I know there's no problem with the php file, but I can't get it to work in Flash 8 (with AS2). Please help!
Here's the actionscript:
Code:
submitButton.onPress = function() {
emailCheck();
};
function emailCheck() {
if ((this.emailAdd.length<5) || (this.emailAdd.indexOf("@")<=0) || (this.emailAdd.indexOf("@") !=this.emailAdd.lastIndexOf("@")) || (this.emailAdd.lastIndexOf(".")<this.emailAdd.indexOf("@")) || ((this.emailAdd.lastIndexOf(".")+3)>this.emailAdd.length)) {
emailBlock.text = "Enter a valid email address";
} else {
loadVariablesNum("process.php", 0, "POST");
getURL ("javascript:NewWindow=window.open('next_step','newWin','width=700,height=500,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
emailBlock.text = "success";
}
}
-
my first suggestion would be to use the LoadVars object for sending/receveing data from server-side scripts..
u can download a flash-php feedback form example from my library
-
Thanks silentweed! your library is very helpful and your suggestion worked.
Do you know why loadVariablesNum does not work? Is it a deprecated term in F8?
-
for sending/receving data from server-side scripts, LoadVars is now the recommended way .. as you only send the variables you choose to and also you have event handlers which are fired, which help you to know when the data is recieved back etc ..