dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: sending input text content to PHP using GET

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Posts
    13

    [CS3 but AS2] sending input text content to PHP using GET

    This is for a newsletter signup, Im simply brainfarting on how to reference the content of the input box.

    I have an input text field with a variable name of 'email' and an instance name of 'input_email'. Im using the code below on a button:

    Code:
    on (release) {
    	if (email ne "") {
    		sendvariable = 'http://zarthsan.com/work/spy_test.php?email=' + input_email + '&action_type=register&newsletter=Y';
         getURL(sendvariable,'_self');
    	}
    }
    and Im getting the following message on my testpage.
    -------------
    This is a test script. Below is an array of the variables passed to this script:
    Array ( )

    Nicely Formatted:
    Action Type:
    Newsletter:
    Email:

    Below is the 'GET' variables... this should be empty
    Array ( [email] => _level0.instance2.input_email [action_type] => register [newsletter] => Y )
    -----------

    Basically I need the Array ( [email] => _level0.instance2.... to show the content of input text field like this,

    Array ( [email] => "test@test.com"

    Any thoughts? I feel like Im taking crazy pills.
    Last edited by tkg; 05-23-2008 at 06:04 PM.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    if you are using the instance name - input_email
    you will need to reference the text property of the textfield -

    on (release) {
    if (email != "") { // ne is deprecated in favour of !=
    sendvariable = 'http://zarthsan.com/work/spy_test.php?email=' + input_email.text + '&action_type=register&newsletter=Y';
    getURL(sendvariable,'_self');
    }
    }

  3. #3
    Junior Member
    Join Date
    Sep 2007
    Posts
    13
    When I do that it doesnt transfer the actual text... I get this on my testsite.

    _________________
    This is a test script. Below is an array of the variables passed to this script:
    Array ( )

    Nicely Formatted:
    Action Type:
    Newsletter:
    Email:

    Below is the 'GET' variables... this should be empty
    Array ( [email] => undefined [action_type] => register [newsletter] => Y )
    __________________

    Where it says undefined, its meant to say what was entered in 'input_email'.

  4. #4
    Junior Member
    Join Date
    Sep 2007
    Posts
    13
    Aha! I gace it an instance name of input_email and it worked, thanks for your help!!!

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you're welcome

    a fwiw ..

    before Flash 6 the TextField Class didn't exist.
    In order to read from, or assign content to a dynamic text field you
    would have to use the Var property of the text field.

    Since Flash 6, the Var property is basically useless in comparison to
    what the use of the text property allows.

    imho.. if you're using Var: - delete it, and don't use it again.

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