Ya, I've been thinking about that too.
So join the club.
Problem is, there's no real good across the board method.
If you're into one-off code that is only made to service 1 site, that's fine, but for an application that needs to service multiple sites from the same codebase or copies of it, then you're looking at writing an interpreter.
Sort of like fast templates, but using an XML style data model to instruct how to handle certain fields in certain tables.
To illustrate:
You have a char(1) field with the default value of 'Y'.
How do you know automatically how to handle that?
Chances are it's a checkbox.
But how can you really tell?
Chances are also likely that it's a select value, or even a menu item...
hell, it could even be a hidden form input.
So how do you code for that?
You don't, you have to accept user input based upon the field in that indidual table,
you could get tricky with it and even come up with a stylesheet (back to the XML struct I was getting at)
So you see, you've done nothing more than reinvent the wheel and add additional abstraction and cause for hair shredding where there was never a need.
Which in turn would cause your script to be very unpopular and may even cause some to seek your untimely demise through various innovation in the art of foul play.
Wow...
Seems quite daunting now doesn't it.
So do what I do and forget about a predefined data definition and just make a function to zip the data into the database as fast as possible.
I have a function already in use that does just that, but it's not something I can just slap down with out a page of explanation on how it works.
But, you could easily build a function that loops through the $SERVER['HTTP_POST_VARS']
array and read the key=>value pairs and write out an SQL insert/update/delete based upon some basic control features within the HTML form. You can also write to the $SERVER['HTTP_POST_VARS'] (I always just use $GLOBALS['HTTP_POST_VARS']) before calling your auto SQL function, which would allow you to append data to the HTTP POST before sending it off to the database.