title: table updates empty spaces when user do not enter anything to the textbox
body: <p><strong>The situation is</strong> my program's purpose is to update employee details. The user may choose which of the information <em>(name,position,department and tag(which tells if he/she is still employed to the company))</em> he/she wants to update. He or she may or may not fill up all the details as he/she wants to. In other words,he/she may leave it blank if he/she is not going to change that certain information.</p>
  
  <p><strong>MY PROBLEM IS</strong> the updating. it is now updating. But then for example,if the user wants to change only the position information of that employee,he/she will leave the name,department blank.<em>(tag is by default set to yes so there is always a value)</em>. when the user clicks the submit button. it updates the table <strong>BUT</strong> it updates the empty text box to spaces. meaning, in the example. In the database, the name and department will contain "spaces".</p>
  
  <p><strong>MY GOAL</strong> is that,if the user leaves a text box empty,the original value should remain. it will only change the inputed values.</p>
  
  <hr>
  
  <p>here is the code i used in my empinfo.php <em>(NOTE: this one is a pop up,the emp, came from the index,but there is no problem about that :D )</em></p>
  
  <pre><code>&lt;body&gt;
  &lt;center&gt;
  &lt;table class="main" border="0" cellpadding="0" cellspacing="0"&gt; 
  &lt;form action="empinfo.php" method="POST"&gt;
  &lt;input type='hidden' name='submitted' id='submitted' value='1'/&gt;
  &lt;input type='hidden' name='eid' id='eid' value= '&lt;?php echo $_GET['emp']?&gt;' /&gt;  
  
  &lt;fieldset&gt;
              &lt;div class='container'&gt;
                  &lt;label for='ename' &gt;Employee name:&lt;/label&gt;&lt;br/&gt;
                  &lt;input type='text' name='ename' id='ename' maxlength="50" /&gt;&lt;br/&gt;&lt;br/&gt;
               &lt;/div&gt;
  
               &lt;div class='container'&gt;
                  &lt;label for='pos' &gt;Position:&lt;/label&gt;&lt;br/&gt;
                  &lt;input type='text' name='pos' id='pos' maxlength="50" /&gt;&lt;br/&gt;&lt;br/&gt;
               &lt;/div&gt;
  
              &lt;div class='container'&gt;
                  &lt;label for='dep' &gt;Department/Division:&lt;/label&gt;&lt;br/&gt;
                  &lt;input type='text' name='dep' id='dep' maxlength="100" /&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
  
              &lt;div class='container'&gt;
                  &lt;label for='tag' &gt;Employee Tag:&lt;/label&gt;&lt;br/&gt;
                  &lt;select name="tag" id="tag"&gt;
                      &lt;option value="Y"&gt;Yes&lt;/option&gt;
                      &lt;option value="N"&gt;No&lt;/option&gt;
                  &lt;/select&gt; &lt;br/&gt;&lt;br/&gt;
              &lt;/div&gt;
  
              &lt;div class='container'&gt;
                  &lt;input type='submit' name='Submit' value='Submit' /&gt;
              &lt;/div&gt;
  &lt;/fieldset&gt;
  
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;?php   
  $con=mysql_connect('localhost','root','mariel') or die(mysql_error());
  mysql_select_db('intranet',$con);
      if(isset($_POST['submitted']))
      {
  
      $sql = "SELECT * FROM gpl_employees_list where emp_id='".$_POST['eid']."'";
      $result = mysql_query($sql) or die (mysql_error());
      if(!$result || mysql_num_rows($result) &lt;= 0)
                              {                       
                                  return false;
                              }
  
      $qry = "UPDATE gpl_employees_list SET emp_nme = '".$_POST['ename']."', emp_pos = '".$_POST['pos']."', emp_dep = '".$_POST['dep']."', emp_tag = '".$_POST['tag']."' WHERE emp_id = '".$_POST['eid']."' ";  
  
      mysql_query($qry) or die (mysql_error()); 
  ?&gt;&lt;script&gt;window.close();&lt;/script&gt;&lt;?php 
          }       
      ?&gt;
  &lt;/table&gt;
  &lt;?php mysql_close($con); ?&gt;
  &lt;/center&gt;
  &lt;/body&gt;
  </code></pre>