title: jquery update multiple field
body: <p>is there something wrong in the code? <strong>its not actually updating all textinput</strong> but only updating the first input id=1 after save is clicked!</p>
  
  <p>HTML Markup:</p>
  
  <pre><code>&lt;input type="text" id="1"&gt;
  &lt;input type="text" id="2"&gt;
  &lt;input type="text" id="3"&gt;
  &lt;input type="text" id="4"&gt;
  &lt;input type="text" id="5"&gt;
  &lt;input type="text" id="6"&gt;
  </code></pre>
  
  <p>JQUERY:</p>
  
  <pre><code> $('#save_affiliate').live('click',function() {
              var $inputs = $('#affiliate_form');
              $inputs.each(function(){
                  var counter = $(this).find("input[type=text]").length;
                  var af_value = $(this).find("input[type=text]").attr("value");
                  var af_id = $(this).find("input[type=text]").attr("id");
                  if(counter&gt;0){
                      $.post("include/setting.php?affiliate",{id:af_id, text_value:af_value, count:counter}, function(data){
                          if(data.success) {
                                  $('.err').html(data.message).fadeIn('slow');
                          } else {$('.err').html(data.message).fadeIn('slow');}
                      },"json");
                  }
              });
              return false;
          });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$counter = $_POST['count'];
  $value = $_POST['text_value'];  
  $id = $_POST['id'];
  $i = 0;
  if ($counter != 0) :
      while($i&lt;$counter) :
      $db-&gt;query("UPDATE affiliate SET d_percent='$value' WHERE id_affiliate='$id'");     
      endwhile;
  
      $data["message"] = "Affiliate percentage value has been changed!";
      $data['success'] = true;
  endif;
  </code></pre>