;

PDA

Click to See Complete Forum and Search --> : php email form problem


toasty-o
08-24-2007, 01:25 AM
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:

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','newW in','width=700,height=500,toolbar=No,location=No,s crollbars=No,status=No,resizable=No,fullscreen=No' ); NewWindow.focus(); void(0);");
emailBlock.text = "success";
}
}

silentweed
08-24-2007, 09:18 AM
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

toasty-o
08-24-2007, 08:16 PM
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?

silentweed
08-29-2007, 06:21 AM
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 ..