Dynamic Drop down With Non selectable items

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dbarron87
Forum Newbie
Posts: 16
Joined: Wed Apr 20, 2011 8:12 pm

Dynamic Drop down With Non selectable items

Post by dbarron87 »

Hello all, hopefully i have put this in the right place.

I am currently trying to create a drop down list with data pulled from my database, but with non selectable items.

the drop down is fully working, with items being pulled from the db

it currently displays like below

avon
antrim
aberdeen

ect
however i would like it to be similar to below

England (non selectable)
avon
Northern Ireland(non selectable)
Antrim
Scotland(non selectable)
Aberdeen


I am able to create empty spaces (by making them null) but would rather this to be text.


Thank you for your help in advance
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: Dynamic Drop down With Non selectable items

Post by tr0gd0rr »

I think you need optgroup tags.
Post Reply