I'm trying to find a bit of code that will do the following:

1) You have a SELECT field called "catidselect", which has a list of a load of categories (with values held as "ID" numbers)
2) Someone selects one of the categories, and then a new SELECT field (called "catid") is updated with a list of categories that exist in and array (?) , ready for people to just select that.

I'm 100% sure this is possible, but can't find any code samples anywhere :/

Any ideas?