Generating a selectbox from an Enum

admin

Administrator
Staff member
Hi,

I'm trying to create a generic admin interface that will work with any database.

It is relying on the mysql_fetch_field function to determine what the field type is so a html form can be generated.

I would like to be able to generate an "on the fly" selectbox for an enum field with the enum choices as options. Has anyone had any success with this? I couldn't find anything useful in the archives.

eg
<= THIS =>

+-----------+------------------------+
| Field | Type |
+-----------+------------------------+
| status | enum('active','disabled') |
+-----------+------------------------+

<= INTO =>

<select name=status>
<option value='http://www.phpbuilder.com/board/archive/index.php/active'>active
<option value='http://www.phpbuilder.com/board/archive/index.php/disabled'>disabled
</select>

thanks
steve
 
Back
Top