This is UNTESTED (ie off the top of my head) and is for postgresql...
this snippet should connect to your database and then put the names of all the
fileds in table tbl_foo into an array called $field_array. eg, if tbl_foo has
fields name 'name' 'address' and 'dob' then $field_array[0] should be "name",
$field_array[1] = "address" and so forth...
$db = pg_connect("", "", "", "", DATABASE);
$result = pg_exec($db, "select * from tbl_foo");
$listing_array = pg_fetch_array($result, 0);
while(list($key,) = each($listing_array))
$field_array[] = $$key;
pg_close($db);
then you should be able to do this:
print "enter $field_array[0] :";
print "<option type=\"text\" name\"$field_array[0]\">";
like i said, i haven't tested it, but it should work with only minimal tweaking.
frymaster