title: Process only edited fields in Codeigniter form
body: <p>I have a multi field search form I'm creating. There are 9 different search fields. None of them are mandatory, though. The only requirement is that you have to fill in at least one field.</p>
  
  <p>They all show a default value (i.e. 'State') upon load instead of using labels to indicate what the purpose of the search field is. So, if you edit one field but leave the other eight alone then all nine will still have a value posted.</p>
  
  <p>Is there any good, efficient way to handle this? I'd prefer to not have to manually do the logic in either jQuery before posting (e.g.<code>if($(inputid).val() == 'Default Value') { ...</code>) or the controller (e.g. <code>if($this-&gt;input-&gt;post('name') == 'default value') { $data['name'] = ''</code>) because there will be a few iterations of this search throughout the site, so a dynamic solution would be incredibly helpful and save a bunch of time.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>EDIT</strong>
  here's the gist of what I ended up with after @veddermatic's post below:</p>
  
  <p>rendered form:</p>
  
  <pre><code>&lt;form id="search-form" action="spend/search"&gt;
  &lt;input id='fname' value='First Name' data-original_value='First Name' name='fname'/&gt;
  &lt;input id='lname' value='Last Name' data-original_value='Last Name' name='lname'/&gt;
  ...
  &lt;/form&gt;
  </code></pre>
  
  <p>ghost form:</p>
  
  <pre><code>&lt;form id="ghost-form" action="spend/search"&gt;
  &lt;!--nothing here yet--&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>jquery to handle it all:</p>
  
  <pre><code>$('.do-the-search').click(function(e) {
          e.preventDefault();
  
          $('#search-form input').each(function() {
              var $this = $(this);
  
              if($this.attr('data-original_value') != $this.val())
              {
                  var clone = $this.clone();
                  $("#ghost-form").append(clone);
              }
          });
  
          $("#ghost-form").submit();
  
      });
  </code></pre>