PHP : generate a HTML form from database
Simplify
The EasyMel library aims to simplify or automate the creation of some functionality. For this purpose I deliver the first one that allows you to generate an HTML form from a database table.
EasyMelFormGenerator Class
This class allows the generation of an HTML form from a database table.
1. Form
When you realize a web application, forms are unavoidable and can be quite repetitive to do. It is clear that in most cases the data in these forms are intended to be stored in a database. Why not then generate all of these forms from the database?
Form data stored in one table
In this cas, it’s pretty simple. The form can’t be easily generated, and the data stored and filled from the table.
Form data stored in multiples tables (not implemented yet)
In this case, it’s a little bit more complex, but still simple. All we have to do is to group fields by table name, so each field will be linked to the right table.
Cache the form (not implemented)
To avoid regenerating the form each time it will be necessary to plan its caching. This becomes really interesting when the generation of the forms greatly solicits the accesses to the database
Relationship between fields (not implemented yet)
Managing relationships between different fields could be really interesting and would allow for advanced forms. Thus, for example, action on a drop-down menu would update another drop-down menu without writing a single line of HTML or JavaScript code.
And much more things coming…
Live demo, source code and documentations
Live demo : demo example-basic.php
See all the source codes on Github : EasyMelFormGenerator
And the documentations : Github documentations
Poster un Commentaire
Soyez le premier à commenter !