Is there an easy way to skip updating a field to an empty value in a database?
<p>This starts when a user fills out a form with optional inputs. The values are passed by AJAX to another PHP page to insert into a database. If a particular input is empty, I don't want to update the data stored in the database. Is there a way to check, besides writing lots of <code>if</code> statements, to see if an input value is empty? If it is empty, how can I write the statement so MySQL won't update the corresponding field in the database?</p>

<pre><code>if(isset($_POST['f_name']) &amp;&amp; isset($_POST['m_name']) &amp;&amp; isset($_POST['l_name']) &amp;&amp; isset($_POST['alt_name'])){
    $fname = $_POST['f_name'];
    $mname = $_POST['m_name'];
    $lname = $_POST['l_name'];
    $altname = $_POST['alt_name'];
</code></pre>

<p>If some of the $_POST entries are empty, then they shouldn't be put into the database. I'm saying this because if there's already an existing value in the database, I don't want to overwrite the value with an empty one.</p>
