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

Link to comment
Share on other sites

???

 

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.

 

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.