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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 to the client (I'd use JSON for this)
4. Populate the select

> I can fill in a <DIV> (as per the ten million examples out there)
> and that's all fine and dandy, 

So you can already do the first three stanges then? That just leaves stage
4.

One quick google later:

http://www.google.com/search?q=JavaScript+dynamically+populate+select

And the first hit is:

http://www.petenelson.com/aspwatch/ASPWatch%20%20Using%20Javascript%20to%20Dynamically%20Populate%20Select%20Lists.htm

Which tells you how to do it (ignore the ASP mention, the article is all
JavaScript).

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux