I have something similar in place and it's really stable.
All you have to do is to get the
coloumns from your table, and
generate your input fields
dynamically
Then, when it's posted back, implode everything, into a string. Check if the coloumn names received matches the ones in your table and implode also the values. Add_slashes and escape any quotes or other possible sql injection characters.
The following code is the one I use for a MASSIVE project/s.
$postvars = $_POST;
$q = "replace into `".$opertable."`
(
`".(implode('`,`',(remove__v(array_keys($postvars)))))."`)
values
(
'".(implode('\',\'',$postvars))."')";
remove__v removes some validation techniques and submit buttons etc with the function below
function removeObj($array) {
foreach($array as $key => $value) {
if (substr_count($key,'obj__')) unset($array[$key]);
}
return $array;
}
all my input buttons are named as obj__*
Hope you get the idea.