Forum Moderators: coopster

Message Too Old, No Replies

Sorting a Dynamic Drop box

         

joe1182

12:09 pm on Dec 13, 2004 (gmt 0)

10+ Year Member



I have a drop box that is being populated by my database but, I would like to sort alphabetically. Is there anyway to do this? Also is there a way when an item in the drop box is selected that other fields in that database table will automatically appear in a seperate text box that I designate? Like I want "cutomer name" to be the option to choose from in the drop box. When selected I want "customer address" and "customer phone" to appear in their own seperate text boxes. Any help would be greatly appreciated.

joe1182

1:38 pm on Dec 13, 2004 (gmt 0)

10+ Year Member



Can anyone help me out?

coopster

1:59 pm on Dec 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would sort the data as I retrieve it from the database using an ORDER BY clause.
SELECT lastname, firstname FROM table ORDER BY lastname;

joe1182

2:26 pm on Dec 13, 2004 (gmt 0)

10+ Year Member



thanks coopster! Any help on the second part of my question?

dreamcatcher

2:31 pm on Dec 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi joe1182,

I believe what you are looking for here is javascript. If you want the options to appear for instance after a page refresh, then yes, you can do this with PHP. But if you mean having the boxes change automatically client side, this is a javascript thing.

If it is javascript you are after, try the javascript forum.

dc :)

joe1182

2:42 pm on Dec 13, 2004 (gmt 0)

10+ Year Member



thanks