Why not just change the SQL to only avg the numbers that are not 0?
But the answer is to
a) allow the DB field to be null, with no default
b) put some if...then statements to have a look at the value from the text box and if it is not null then insert the value...
$sql= "insert into table values("
if (isset($field)) {
$sql=$sql." $field,"
}
$sql=$sql." $anotherfield, $3rdField")
hth
bastien