Jump to content

Auto create form fields from mysql table colums …


Frank100

Recommended Posts

Hi, is there a way in php to look up a mysql table and use the column headings as form field variables … meaning with this php program the entire table columns are displayed as form fields in the browser ?

 

No need then to build the form by hand … in this consequence there could be a input type column and a width column which could be used to also automatically create the right types of fields for that particular mysql table …

 

Regards,

Frank

 

 

hdu43hd

???

 

This only works once the table has been created...

 

to create a table you use

 

"CREATE TABLE `tablename`...' followed by the field name, type, attributes, NULL or NOT NULL, default value, (key type)...

 

all those bits are what SHOW COLUMNS get for you. So, use the result of your show query, loop through each record and each array returned by each record to fill in the info for you.

 

If you want help then post an example of what you need, the table you are using to generate info (the one you run the show query on) and the table structure you expect it to create.

 

 

Hi and thx for reply,

 

yes, I'd need help with a code please, which would be a sample for me how the code is to achive to get a .htm where each field of the table is represented as an input field in the .htm. Also using the column names and using the widthand field_type infos from the mysql_table content to define the width of each html input_field and field_type.

 

www.hfpz.net/support/php/auto_input_table/city_table_01.jpg

www.hfpz.net/support/php/auto_input_table/city_table_01.sql

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.