[eluser]tonanbarbarian[/eluser]
there are multiple issues with what you are doing and why it is not working the way you expect
mysql
if you insert data into a mysql table with fields that are not null, and you do no give a value for the not null fields, then mysql will supply its own default value
any text type fields, i.e. varchar, char, text, mediumtext, longtext etc will be given an empty string as the value
any numeric fields will be given 0 as the value
html
if you submit a form with nothing in text fields, then those fields do return empty strings as their values, rather than not returning any values at all
so your code will receive values for each of the fields, but the values will be empty string, i.e. ''
arrays
your code is taking the POST values for the 4 fields and adding them to the $data array with specified indexes
then in your model you are checking if the $data array is not empty
it will never be empty because you are assigning empty strings to specified indexes in the array. the indexes will ensure the array is never empty even if all the values of all of the indexes are empty.
also there is a difference in both mysql and php between an empty string and a null value.