Skip to content
Advertisement

CodeIgniter – how to post value from form as NULL instead of 0

In my database it is a table: tab_companies and a column company_phone (big integer) with defalut value set to NULL.

When somebody fill the form and will leave the phone number field empty Code Igniter should add a NULL value to the database, but instead I am having always value ‘0’.

JavaScript

What I am doing wrong?

Advertisement

Answer

you could do, set it to NULL in case its empty, like:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement