Combobox data

Discussion in 'HTML & Website Design' started by questuk, Dec 4, 2013.

  1. #1
    Hi All, I am new to AS3. I hope tis is the correct forum for this question. I am using a combobox component for my project in AS3. I want a user to select a value from a drop down list. Then, the values the user selected to be loaded into a mysql database when the button has been submitted.

    I know how to add items to a combobox and how to query a database in php.
    But, I'm unsure how to insert data from a combobox to store in the database?

    I am guessing I would need the combobox variable to be assigned to the urlvariable and then to urlrequest's data property?. Can you please take a look at my code below:
    Any help would be appreciated.

    var phpVars:URLVariables = new URLVariables();


    var phpFileRequest:URLRequest = new URLRequest("myPhp.File");

    phpFileRequest.method = URLRequestMethod.POST;

    phpFileRequest.data = phpVars;


    var phpLoader:URLLoader = new URLLoader();

    phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

    phpLoader.addEventListener(Event.COMPLETE, showResult);


    phpLoader.load(phpFileRequest);


    phpVars.email = email.text;

    phpVars.password = password.text;


    email.text = "";

    password.text = "";


    //Check to see if the fields are empty

    function showResult(event:Event):void{

    status_Txt.text = "" + event.target.data.systemResult;

    trace(event.target.data.systemResult);


    //Combobox select a value to the database

    var persons:Array = new Array();

    persons[0] = "Select";

    persons[1] = "Male";

    persons[2] = "Female";


    persons.dataProvider = new DataProvider(persons);

    combo_box.addEventListener(Event.CHANGE, dataHandler);


    function dataHandler(event:Event):void{

    trace(event.target.value);
     
    questuk, Dec 4, 2013 IP