title: Update row only for !empty $_POST values
body: <p>This is what my input form looks like:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td class="standard_text_bold" width="25%"&gt;First name:&lt;/td&gt; 
      &lt;td class="standard_text_bold" width="25%"&gt;&lt;input type="text" name="FirstName" value="&lt;?echo $Name;?&gt;" &lt;?php if ($Status != "New customer") { echo "disabled"; } ?&gt;&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td class="standard_text_bold" width="25%"&gt;Last name:&lt;/td&gt;  
      &lt;td class="standard_text_bold" width="25%"&gt;&lt;input type="text" name="LastName" value="&lt;?echo $Lastname;?&gt;" &lt;?php if ($Status != "New customer") { echo "disabled"; } ?&gt;&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td class="standard_text_bold" width="25%"&gt;Email:&lt;/td&gt;  
      &lt;td class="standard_text_bold" width="25%"&gt;&lt;input type="text" name="Email" value="&lt;?echo $Email;?&gt;" &lt;?php if ($Status != "New customer") { echo "disabled"; } ?&gt;&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>It's very general, and in a specific case, almost all inputs will be disabled.</p>
  
  <p>I define all my inputs as </p>
  
  <pre><code>$LastName = $_POST['LastName'];
  $FirstName = $_POST['FirstName'];
  </code></pre>
  
  <p>And I run an update query</p>
  
  <pre><code>mysql_query("
      UPDATE data SET
          FirstName = '$FirstName',
          LastName = '$LastName',
          ProductName = '$Productname',
          ProductPriceUSD = '$Productpriceusd',
          ProductPriceEUR = '$Productpriceeur',
          ProductLink = '$Productlink',
          Status = '$Newstatus',
          Modified = now()
      WHERE ID = '$id'
  ") or die(mysql_error());   
  </code></pre>
  
  <p>Now I'd like to update ONLY those values that are not empty. Since this is a general query, is it possible to validate variables within the query itself?</p>
  
  <p>I've tried stuff like:</p>
  
  <pre><code>if (empty($_POST['LastName'])) {
      $LastName = $row['LastName'];
  }
  if (!empty($_POST['LastName'])) {
      $LastName = $_POST['LastName'];
  }
  </code></pre>
  
  <p>But it doesn't work for some reason. Any suggestions?</p>