I have a form which - when submitted - enters the values into a db and returns the user back to the form which is then prefilled with the data theyve just enetered into the db.
This work fine. HOWEVER, if they dont enter anything into a field that is expecting a decimal number - when they are returned to the page - the field shows ‘0’ whereas it SHOULD show nothing.
The field datatype is decimal(10,1); Null to Yes and Ive set the default value to NULL.
No, the statement that actually creates the table in the first place.
Though I think the insert/update statement may be useful too and var_dump of the values you insert.
Does the database actually contain a zero in the field, or is it being formatted that way when the form and contents are redisplayed after submissions?
The record is created by another script elsewhere on the site and the values have nothing in (null). When I click the update button and nothing is in the field then ‘0’ appears in the record. So yes, the database actually contains a zero in the field.
Good idea.
Ive just checked the script thats generating the record and it doesnt mention any other fields other than generating the id for the new record.
… So… is it the fact that - on the Update Form - the fields being passed to the update sql that havnt been entered are auto filling the integer fields with zeros? (The default value for these fields are Null)