[PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread David Dorward
Daevid Vincent wrote: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Break it down in to stages. 1. Make the request to the server 2. Have the PHP gather the data from the database 3. Return the data

[PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Greg Beaver
Daevid Vincent wrote: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the select box to fill in

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Manuel Amador (Rudd-O)
Greg Beaver wrote: Daevid Vincent wrote: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the input field, I want the

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Greg Beaver
Manuel Amador (Rudd-O) wrote: Greg Beaver wrote: Daevid Vincent wrote: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Manuel Amador (Rudd-O)
Greg Beaver wrote: This is far too complicated. You don't need 50 lines of code to convert from server-side data to HTML when the browser does it for you (and far more efficiently) with this code: var someCallback = { ajaxfunc: function(res) {

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Greg Beaver
Manuel Amador (Rudd-O) wrote: Greg Beaver wrote: This is far too complicated. You don't need 50 lines of code to convert from server-side data to HTML when the browser does it for you (and far more efficiently) with this code: var someCallback = { ajaxfunc: function(res) {

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Manuel Amador (Rudd-O)
1) what if the returned markup is invalid? Well, the browser renders it oddly, and through the fact that your server-side code is straightforward filling in an html template with actual values, all you need to do is view the source (with the firefox web debugging extension you can view

[PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Manuel Lemos
Hello, on 03/17/2006 11:42 PM Daevid Vincent said the following: I need to dynamically update a select box with results from a SQL database using AJAX, but I can't find a single example of how to do this. Basically I have a text input field, and a select box. As someone types in the

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Greg Beaver
Manuel Amador (Rudd-O) wrote: 1) what if the returned markup is invalid? Well, the browser renders it oddly, and through the fact that your server-side code is straightforward filling in an html template with actual values, all you need to do is view the source (with the firefox web

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Manuel Amador (Rudd-O)
Greg Beaver wrote: This is obvious: you need only test the output of the PHP server class, All the more reasons to use a serialization markup language instead of just plain HTML. Testing for specific HTML output may break if the HTML output changes, but not if you're using XML or JSON,

Re: [PHP] Re: PHP, SQL, AJAX, JS and populating a SelectBox?

2006-03-18 Thread Greg Beaver
Manuel Amador (Rudd-O) wrote: Just for argument's sake: the result is not identical. Assume, for one second, that you have two PHP functions: function getCitiesAsHTML($countryName); function getCitiesAsXML($countryName); The first issues a snippet of HTML text, with options. The second