How to save empty form field as null?
<p>I have a html form that sends POST data to php file.
In php I'm making a query to mysql database. In database I have int column that accept null.</p>

<p>The problem is when web form field is empty, I want to save null to database.
I tried to make check before building the query</p>

<pre><code>if (empty($licence))
        $sql_query.="null,r1=";
    else $sql_query.="'".$_POST["licence"]."',r1=";
</code></pre>

<p>It's working. But if user write 0 in the form field, in database will be saved null, which is wrong. If user entered 0, I want to save 0, but if the field is empty I want to save null. How to fix this??
The problem is that if field is empty, 0 will be send as post data...</p>
