If you have been a Web Database Developer for even a short time you will realise that most of your work is creating web forms and most of those forms do basically one action: updating records in a single database table.
Having to completely rewrite code to do basically the same task for every form is not only annoying it's a waste of time. You can copy and paste but in the long run it takes almost as much time to make sure that you removed all of the data from the previous form and adapted it to the new table.
So what is the answer?
Well after several years as a Web Database Developer I knew what the answer was, create a Class to build the form based on a database table, I just never got around to doing it.
Until now that is.
So here is the Website for dbForm, my first attempt at a class to build a form in PHP.
Unlike some other form classes that exist for various programming languages you do not have to do very much to get this class to work. In the simplest case point the class at a table and give it a template file and you are done.
However don't think for a minute that this is all the class can do...it can do alot more.
List of current abilities
- Connects to any database through ADODB
- Detects and creates form fields for all database fields
- Creates default buttons for processing
- Ability to add/remove fields/buttons
- Ability to create your own functions to process form actions such as insert, update and delete
- Optional auto-update of data in form
- Simple yet powerful template system to design layout
- Template class can be used by itself
- Storing of dbForm class in session between page requests to minimise processing time
- new Filtering of Search list
Planned future abilities
- Server Side Validation (most likely using regular expressions)
- Ability to create control arrays (i.e. 2 or more fields with the same name. e.g. radio buttons)
I would like to give a big thanks to the developers of
ADODB for the work they
have done, without which I would not have been able to produce dbForm.
In my humble opinion ADODB is the best way to connect to a database in PHP.
To use dbForm you require the following as a minimum:
- PHP 4.1+ (tested on 4.1.2 and 4.3.2)
- ADODB 3.11+(see ADODB website at http://php.weblogs.com/ADOdb)
- A database with some tables (MySQL recommended)
- A Webserver capable of running all of this
27 May 2004
Made the following changes
- Made it possible to remove a button AFTER the form has been processed.
- Added parameter to removeField, removeButton and clearButtons to have some text to replace the fields or buttons with.
- Added code to remove the select button after autoSelect or filtering.
- If a filter doesn't have default text then it uses "Select a Filter Group".
- Fixed formActions problem.
- Set some default values to null.
- Fixed some filtering problems.
- Fixed a button processing problem.
- Fixed some field processing problems.
- Disabled validation during filtering.
- Added select-display type that displays the selected value from a selet list rather than the list.
Sorry that it has been so long between dbForm updates.
I have also been a bit lax in answering forum posts, although I have got back on track in the last few weeks.
Good new though because I have been using dbForm at work in a commercial environment for several months now so you can be sure that the code is very stable.
It has only been thoroughly tested in MySQL and Oracle environments though so there may still be some issues with other database platforms.
What is the future of dbForm?
I am not certain of the future of dbForm myself for several reasons.
- I have wanted to change the name of the project for a while because there are actually several other projects called dbForm.
- I have had ideas of using dbForm as the base for a group of classes that could be used to create a CMS portal system. This would definately result in a name change.
- I have had issues with the templating system dbForm uses because in some situations the Perl Regular
Expression library used can crash causing server errors, and of course not displaying the page.
On Windows this may also cause the webserver software to crash when in API mode.
Due to this I have experimented with other templating ideas and have been unable to come up with one that I am 100% happy with.
- I have started looking more to creating modules for existing CMS Portals rather than creating my own (which is alot of work).
For now I will continue to support the current version, but I may or may not release new versions, and if I do it may be a completely new product with a completely new templating system.
While I am not abandoning the project if there is anyone who is willing to help with development, and maybe even taking over the project please let me know.