A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: php email form problem

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    1

    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";
    	}
    }

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    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
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    1

    resolved

    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?

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    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 ..
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center