Reading data in to ComboBox from PHP page. (corrections)

Actually I made this post long back but the post had some corrections so iam making those here. It was actually suggested by a a person called John that he didn’t get the post clearly and insisted to make another one for newbies. So I decided to make a clear one here with complete code.

The post missed one line as it was pointed out in the comment , the line is to send the HttpService you are using to get the Data.

Flex code :

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute

creationComplete=”projectsSrv.send();”>

<mx:HTTPService

id=”projectsSrv

url=”new.xml

useProxy=”false” method=”POST>

</mx:HTTPService>

<mx:ComboBox

id=”cmb1” x=”152” y=”53

dataProvider=”{projectsSrv.lastResult.records.record}

labelField=”data></mx:ComboBox>

</mx:Application>

PHP code or XML file code:

<records>

<record data=”1″ label=”Corco”/>

<record data=”5″ label=”Shell Crop Protection”/>

<record data=”7″ label=”Olin McIntosh”/>

<record data=”9″ label=”Crab Orchard”/>

<record data=”10″ label=”Shell Oil Del Amo”/>

<record data=”11″ label=”AIG South Jersey Gas”/>

<record data=”12″ label=”Husch &amp; Eppenberger Litigation-New York”/>

<record data=”22″ label=”Shell Sturbridge”/><record data=”24″ label=”Shell Southington”/>

<record data=”26″ label=”Olin Personal Injury”/>

</records>

You can send data in this format or get it from the XML file, here its from XML file “new.xml”.you can even echo these lines in PHP and a file as new.php.

As you can see the difference here, from that post is, here iam using the line creationComplete=”projectsSrv.send();” in the Application tag to send the service and read the data.

Now it will work fine and comments are welcome !

Advertisements

8 Responses to Reading data in to ComboBox from PHP page. (corrections)

  1. […] Reading data in to ComboBox from PHP page. (corrections) Possibly related posts: (automatically generated)Sending data from PHP as XML.<?php echo md5(”just_a_test”);?> « ~/BlogExercise 6Restarting Windows Services in a PHP Script […]

  2. twentyone says:

    Hi Kumar,
    thank you for your Tutorial. But i can´t load data from a MYSQL DB. Please are you so friendly and help me. I donßt know what else to do.

    Here´s the Code Examples:

    Flex:
    ——

    PHP:
    ——-
    id.””.$User->kuerzel.””;
    }
    $Return .= “”;
    mysql_free_result( $Result );
    print ($Return)

    ?>

    Thank you very much for your help!!

    Regards from Austria,
    twentyone

  3. twentyone says:

    Anything happens with the Flex Code.
    Here´s again:

  4. twentyone says:

    I don´t know why the posted Flex Code from me is´nt showed.
    I try it again.

    <!–

    –>

  5. twentyone says:

    Please Kumar can you tell me why i can´t post Flex Code.

    Thank you!
    Regards, twentyone

  6. twentyone says:

    This is the dataProvider. Everything else is not touched.

    dataProvider=”{projectsSrv.lastResult.team.gesamt}”

    • kumargandhi says:

      Hi twentyone,

      According to your dataProvider dataProvider=”{projectsSrv.lastResult.team.gesamt}” we got to serialize the output of the PHP code accordingly.

      echo “team”;
      echo “gesamt”
      echo “id”.$User->id.”/id”;
      echo “/gesamt”
      echo “/team”;

      in the above lines you require to add the Left Angular Brackets and Right Angular Brackets according to the XML List, here it will dissolve.so it wont show.

      Sorry for the late reply , comment me if you require further help.

      regards,
      kumar.

  7. Ripon says:

    How i load data in combo box with code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: