title: Submit button inside foreach loop update all table rows instead of one row
body: <p>I created this simple function to update a row inside a table called <code>wp_todos</code></p>
  
  <pre><code>function update_completed_todos($id,$complete) {
      global $wpdb;
      $table_name = $wpdb-&gt;prefix . 'todos';
      $result = $wpdb-&gt;get_results("SELECT id FROM " . $table_name .  " WHERE id = '" .$id."'");
      if (count ($result) &gt; 0) {
          $wpdb-&gt;update( 
              $table_name, 
              array(  
                  'complete'   =&gt;  $complete, 
              ),
              array( 'id' =&gt; $id )
          );
      }
  }
  </code></pre>
  
  <p>It simply passes 2 variables: <code>$id</code> and <code>$complete</code>.</p>
  
  <p>Then I created a <code>foreach</code> loop:</p>
  
  <pre><code>$todos = $wpdb-&gt;get_results("SELECT * FROM " . $table_name);
  foreach ($todos  as $key =&gt; $value) {
       &lt;input id="&lt;?php echo $value-&gt;id; ?&gt;" type="submit" onclick="&lt;?php update_completed_todos($value-&gt;id, 1); ?&gt;" value="&lt;?php esc_attr_e( 'Done' ); ?&gt;" /&gt;
  }
  </code></pre>
  
  <p>As you see it should submit <code>"1"</code> to a specific column <code>complete</code> in a specific row.
  The issue here is when I click on the button it affects all the rows inside the table instead of the target one row. In other word it makes the entire column <code>complete</code> taking the value of "1".</p>