title: How to create/find right ID in multiple Form elements of same type $ajax function with jQuery Mobile?
body: <p>I have a collapsible part of my jQuery Mobile page that are generated from PHP output from a MS Sql databas and content render as I like it to so that part is ok.</p>
  
  <p>in each section I create a form with 3 buttons and they are supposed to have unique Id:s.
  All forms are also created to have a unique id created in runtime.</p>
  
  <p>actions.php (renders out my elements into mobilepage i  a DIV)</p>
  
  <pre><code> $counter=0; reset counter for ID:s
   while (odbc_fetch_row($rs)){
  
  // data output from Db to make like 10 collapsible with different data
      $html = "";
      $html = "&lt;div data-role='collapsible-set' data-mini='true'&gt;";
          $html.="&lt;div data-role='collapsible' data-mini='true'&gt;";
          $html.="&lt;h3&gt;&lt;span style=float:left;&gt;&lt;img src='../_pic/$image' alt='$imageText' /&gt; ".substr($Time,0,16)."&amp;nbsp;&amp;nbsp;$Area&lt;/span&gt;&lt;span style='float:right;' class='ui-btn-up-c  ui-btn-corner-all' cnt&gt;&amp;nbsp;$data&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;";
          $html.="&lt;p&gt;ID:&amp;nbsp;$ID&amp;nbsp;$Id&amp;nbsp;&amp;nbsp;$Status&lt;br /&gt;$Status&amp;nbsp;&amp;nbsp;$Description)&lt;/p&gt;";
  
          $html.="&lt;form method='post' action=''&gt;";
          $html.="&lt;button value='action1' id='action1$counter' data-mini='true'      type='Submit'&gt;Take Action1&lt;/button&gt;";
             $html.="&lt;button value='action2' id='action2$counter' data-mini='true' type='Submit'&gt;Take Action1&lt;/button&gt;";
             $html.="&lt;button value='action3' id='action3$counter' data-mini='true' type='Submit'&gt;Take Action1&lt;/button&gt;";
          $html.="&lt;input type='hidden' id='id$counter' name='id' value='$dataName' /&gt;";
          $html.="&lt;/form&gt;";
  
          $html.="&lt;/div&gt;";
       $html.="&lt;/div&gt;";
       echo utf8_encode($html);
       $counter++;  //upcount to make Id:s unique 
  } //end While
  </code></pre>
  
  <p>Then I have this function that listens for a button that submit:</p>
  
  <pre><code>$(':submit').live('click', function() { 
    var button = $(this).val();
          if (button == 'action1') { 
               $.ajax({ 
                  url: '../_php/Functions.php', 
                  data: 'button=' + $(this).val()+'&amp;id='+$('#id').val(),  
                  async: true,
                  beforeSend: function() {
                      $.mobile.showPageLoadingMsg(true);
                  },
                  complete: function() {
                      $.mobile.hidePageLoadingMsg();
                  },
                  error: function (request,error) {
                      alert('error');
                  }
              });    
          }
      return false;
    });
  </code></pre>
  
  <p>I cant seem to get another id than the first one since i need to make all ID:s unique in my forms and all I do now is to check: <code>&amp;id='+$('#id').val()</code>. what I would like to have done is to link the button pressed-id number to my hidden field id-number so i get the right data out from it. As of now I only get the first form:s id evaluated...</p>
  
  <p>If someone could point me in the right direction how to make that happen i´d be greatful.</p>
  
  <p>functions.php (a switch statement is pre-testing for submit:ed action</p>
  
  <pre><code>function actions1(){    
  try {
      if(isset($_GET['id'])){
              do stuff with 'id'
      }else{
              do other stuff with 'id'
      }
  } catch(Exception $e) {
     show error
  }
  }
  </code></pre>
  
  <p>If some part is unclear or if you feel I missed posting somepart - let me know. /thanks</p>