# Flash input text field to php

**URL:** <https://forum.kirupa.com/t/flash-input-text-field-to-php/307786>\
**Category:** Uncategorized\
**Created:** [April 10, 2010, 7:35am UTC](https://forum.kirupa.com/t/flash-input-text-field-to-php/307786 "2010-04-10T07:35:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![romit\_2034](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@romit\_2034](https://forum.kirupa.com/u/romit_2034)\
**Post date:** [April 10, 2010, 7:35am UTC](https://forum.kirupa.com/t/flash-input-text-field-to-php/307786/1 "2010-04-10T07:35:44Z")

</div>

I have a login field for a site I am developing. The flash site sends the data to a php file and receives response. My problem is input text fields. If I hard code the values of the variables I am sending from flash to php, the whole thing works just fine, but if I try to set the value of the variables to what a user enters in input fields I have provided, then blank data is sent to PHP.

here is the as file

```auto

package
{
    import flash.display.MovieClip;
    import flash.display.DisplayObjectContainer;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import flash.net.URLVariables;
    import flash.events.IOErrorEvent;
    
    public class login extends MovieClip
    {
        private var loginConsole:MovieClip;
        private var stageIn:DisplayObjectContainer;
        private var variables:URLVariables = new URLVariables;

        private var request:URLRequest = new URLRequest("logintest/login.php");

        private var loader:URLLoader = new URLLoader();
        
        public function login(loginConsoleTemp:MovieClip, stageInTemp:DisplayObjectContainer):void
        {
            loginConsole = loginConsoleTemp;
            stageIn = stageInTemp;
            init();
        }
        
        private function init():void
        {
            loginConsole.logPass_txt.displayAsPassword = true;
            loginConsole.signIn_btn.addEventListener(MouseEvent.CLICK, handleSignIn);
        }
        
        private function handleSignIn(e:MouseEvent):void
        {
            var _username:String = loginConsole.logMail_txt.text;
            var _password:String = loginConsole.logPass_txt.text;
            
            variables.UserName = _username as String;
            variables.Password = _password as String;
            
            loader.dataFormat = URLLoaderDataFormat.VARIABLES;
            request.data = variables;
            request.method = URLRequestMethod.POST;
            loader.addEventListener(Event.COMPLETE, handleComplete);
            loader.addEventListener(IOErrorEvent.IO_ERROR, handleError);
            
            loader.load(request);
        }
        
        private function handleComplete(e:Event):void
        {
            var loader:URLLoader = URLLoader(e.target);
            loginConsole.display_txt.text = loader.data.msg;
        }
        private function handleError(e:IOErrorEvent):void
        {
            trace("not working");
        }
        
    }
}

```

Instead of doing  
variables.UserName = \_username as String;  
variables.Password = \_password as String;

if i assign hard coded values like this

variables.UserName = “something”;  
variables.Password = “something”;

it works fine.

How do I get it to work with input text fields… please help
