Reading data in to ComboBox from PHP page.
First the PHP page looks like this:
echo “<search>”;
echo “<type name=’kumar’ />” ;
echo “<type name=’gandhi’ />” ;
echo “</search>”;
here we have to send data from PHP page in this format.Then to take data in to ComboBox we have to use a HTTPService and dataProvider Property of the ComboBox control.
<mx:HttpService id=”search” useproxy=”false” url=”first.php”/>
<mx:ComboBox id=”searchbox” dataProvider=”{search.lastResult.search.type}” dataField=”name” />
Here in the dataField property specifies which attribute value you wanted from the list.
Here name is the attribute of the <type> tag in PHP and that data i wanted it in the ComboBox list.thats it its simple and small try it..
Leave any comments for suggestions..
April 29, 2008 at 7:53 pm
it doesn’t work!
May 3, 2008 at 9:52 am
Hi Jerry,
It should work , plz check the code once again , or can you paste your code sample here so that i can have a glance and make some suggestions.
regards,
kumar.
May 6, 2008 at 8:35 pm
I get an error that dataField does not exist. The thing is I am using Flex 3 so i am not sure I can use your example!
Thanks
May 8, 2008 at 2:17 pm
Can you paste your code sample here .!
regards,
kumar.
June 16, 2008 at 7:01 pm
Not working for me either.
Flex 3.0:
Php output, saved as .xml file for testing:
June 17, 2008 at 3:14 pm
Kumar said:
It works fine and should work , r u getting any error message , r u sending the Httpservice , the code is correct.Plz have a look .
I don’t get an error message, the file is in the same directory, I don’t know what you mean by “sending the Httpservice”. The combobox just doesn’t get populated.
When you say “It works fine,”, whose code are you referring to, mine or yours?
Mine does not work.
June 17, 2008 at 4:06 pm
Hi guys,
i tried this example. It worked. Only think i did was made few changes to the php page.
below is the php code to display states in XML format:
$sql = “select distinct state from schedule”;
$queryexe = odbc_do($connectionstring, $sql);
$cnt = 0;
$Return .= “”;
while(odbc_fetch_row($queryexe)){
$state = odbc_result($queryexe, 1);
$Return .= “”.$state.”";
}
$Return .= “”;
echo “$Return”;
MXML file:
June 17, 2008 at 4:06 pm
MXML file:
June 18, 2008 at 7:20 pm
Well, I figured it out.
The application tag needs a creationComplete=”search.send()”
Maybe you should specify this in your little blog post so newbies can actually use your example.
Thanks!
June 21, 2008 at 10:36 am
[...] post missed one line as it was pointed out in the comment , the line is to send the HttpService you are [...]