Depending on the method you use for the form, you can try something like this:
Of course you want to make sure that your form field names are exactly the same name and case as your table fields.
$invalidkeys = array('submit'); //Add form field names that you do not want
$qry = "INSERT INTO database (";
foreach($_GET as $key => $value)
$keys .= "`$key`, ";
$values .= "'$value', ";
$keys = trim($keys,', ');
$values = trim($values,', ');
$qry .= " $keys) VALUES ($values)";
I'm sure there's other solutions out there but this is one I actually just implemented today at work.