title: multiple submit on same page with php ajax
body: <pre><code>&lt;div id="home"&gt;
  &lt;div class="container"&gt;
      &lt;form action="" method="post"&gt;      
          &lt;b&gt;&lt;font color = "000099"&gt;&lt;select name="category" id="category"&gt;
          &lt;option&gt;Name &lt;/option&gt;
          &lt;option&gt;Email&lt;/option&gt;
          &lt;option&gt;Employee&lt;/option&gt;
          &lt;option&gt;Customer&lt;/option&gt;
          &lt;/select&gt;&lt;/font&gt;&lt;/b&gt;
          &lt;b&gt;&lt;font color = "000099"&gt;&lt;select name="read" id="read"&gt;
          &lt;option&gt;New&lt;/option&gt;
          &lt;option&gt;Archive&lt;/option&gt;                                    
          &lt;/select&gt;&lt;/b&gt;
          &lt;font color = "339933"&gt;&lt;b&gt;&lt;input name="value" type="text" placeholder="Value" /&gt; &lt;/b&gt;                                   
          &lt;input type="submit" value="GO"/&gt;&lt;/font&gt;&lt;br&gt;
      &lt;/form&gt;
  &lt;font color = "339933"&gt;&lt;b&gt;
  &lt;/b&gt;&lt;/font&gt;
  &lt;p&gt;&lt;div id="body"&gt;
  &lt;table width="98%" border="1"&gt;
  &lt;tr&gt;&lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;font color = "339933"&gt;&lt;b&gt;Name&lt;/td&gt;
      &lt;td&gt;&lt;font color = "339933"&gt;&lt;b&gt;E-Mail &lt;/td&gt;
      &lt;td&gt;&lt;font color = "339933"&gt;&lt;b&gt;Access&lt;/td&gt;
      &lt;td&gt;&lt;font color = "339933"&gt;&lt;b&gt;Update &lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php
  $read = $_POST['read'];
  
  If($read == 'New'){
      $read = '0';
  }
  
  If($read == 'Archive'){
      $read = '1';
      $arc = 'AND date &lt; CURDATE() - INTERVAL 90 DAY';
  }
  
  $category = $_POST['category'];
  $value = $_POST['value'];
  if($category == 'Name'){
      $where = " where name like '%$value%' ";
  }else if($category == 'E-mail'){
      $where = " where Email like '%$value%' ";
  }else if($category == 'Employee'){
      $where = " where Email like '%$value%' ";
  }else if($category == 'Customer'){
      $where = " where Email not like '%$value%' ";
  }
  
  $select = 'SELECT *';
  $from = ' FROM users';
  if($where == ''){
      $where = ' WHERE TRUE ';
  }
  
  $order = " order by id desc limit 100";
  
  if($read == '0'){
      $sql = $select . $from . $where . $order ;
  }else{
      $sql = $select . $from . $where . $arc . $order ;
  }
  
  $result_set=mysql_query($sql);
      while($row=mysql_fetch_array($result_set)) {
  ?&gt;
  &lt;tr&gt;
      &lt;form  method="post" name="forms" action=""&gt; 
          &lt;td&gt;&lt;font color = Black&gt;&lt;?php echo $row['name']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div id= "remail" name="remail"&gt;&lt;font color = Black&gt;&lt;?php echo $row['Email']; ?&gt;&lt;/div&gt;&lt;/td&gt; 
          &lt;td&gt;&lt;input type="text" name="access_rights" class="form-control" value="&lt;?php echo $row['access']; ?&gt;" required="required" &gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="submit" class="submit_button" id="submit_button" name="submit_button" value="Update"/&gt;&lt;/td&gt;
      &lt;/form&gt;
  &lt;?php } ?&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;script type="text/javascript"&gt;
      $(function() {
          $(".submit_button").click(function() {
          alert('asfsfsds');
          var ID = $(this).attr("id");
          var dataString1 = 'msg_id='+ ID;
          var mail =  $("#remail").val();
          var mailid = 'remail='+ mail;
          var textcontent = $("#access_rights").val();
          var dataString = 'access_rights='+ textcontent;
          if(textcontent==''){
              alert("Enter some Value..");
              $("#access_rights").focus();
          } else {
          $.ajax({
              type: "POST",
              url: "action.php",
              data: dataString,mailid,dataString1,
              cache: true,
              success: function(html){
                  document.getElementById('access_rights').value='';
                  $("#access_rights").focus();
              }  
          });
          }
      return false;
      });
  });
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Above is my php ajax code. I want to one field in mysql database by ajax. </p>
  
  <p>There are multiple submit button on the page. Let me explain you properly.</p>
  
  <p>Below code is used for sorting the value on the page. This value retrieve from database. This is working fine. I can get the data from database and it is showing in the same page. </p>
  
  <pre><code>&lt;form action="" method="post"&gt;      
  &lt;b&gt;&lt;font color = "000099"&gt;
      &lt;select name="category" id="category"&gt;
          &lt;option&gt;Name &lt;/option&gt;
          &lt;option&gt;Email&lt;/option&gt;
          &lt;option&gt;Employee&lt;/option&gt;
          &lt;option&gt;Customer&lt;/option&gt;
      &lt;/select&gt;
  &lt;/font&gt;&lt;/b&gt;
  &lt;b&gt;&lt;font color = "000099"&gt;
          &lt;select name="read" id="read"&gt;
          &lt;option&gt;New&lt;/option&gt;
          &lt;option&gt;Archive&lt;/option&gt;                                    
      &lt;/select&gt;
  &lt;/b&gt;
  &lt;font color = "339933"&gt;&lt;b&gt;&lt;input name="value" type="text" placeholder="Value" /&gt;&lt;/b&gt;                                    
  &lt;input type="submit" value="GO"/&gt;&lt;/font&gt;&lt;br&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In below code data is showing from database and one text box and submit button will display in table.</p>
  
  <pre><code>&lt;form method="post" name="forms" action=""&gt; 
      &lt;tr&gt;
          &lt;td&gt;&lt;font color = Black&gt;&lt;?php echo $row['name']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div id= "remail" name="remail"&gt;&lt;font color = Black&gt;&lt;?php echo $row['Email']; ?&gt;&lt;/div&gt;&lt;/td&gt; 
          &lt;td&gt;&lt;input type="text" name="access_rights" class="form-control" value="&lt;?php echo $row['access'];?&gt;" required="required" &gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="submit" class="submit_button" id="submit_button" name="submit_button" value="Update"/&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I want user with special permission can update the value by ajax because there could be multiple rows and it is not good to page get refreshed each time.</p>
  
  <p>At the moment after clicking on update button ajax event not firing.</p>
  
  <p>Can anybody advise me on this. I am not good in ajax. </p>