title: Tried to change value on "onchange" event, it only updates first not second
body: <p>When I tried to change value on onchange function it only updates first one not second. I want to change value Manually. in this problem you see 2 and 2 is equal to 4 but when I want to change second row like there show 4 multiple 4 is equal 16. when change 4 as 5 then its conflict first row I want changes in same row . please help to sort out this problem.</p>
  
  <p><code>test.php</code></p>
  
  <pre><code>&lt;html&gt;
  &lt;title&gt;
  Test
  &lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function taxapply(){
  var one=document.getElementById('one').value;
  //alert(one);
  var two=document.getElementById('two').value;
  //alert(two);
  var equal=one*two;
  document.getElementById('equal').innerHTML=equal.toFixed(2);
  document.getElementById('equals').value=equal.toFixed(2);
  alert(equal);
  }
  
  &lt;/script&gt;
  &lt;body&gt;
  &lt;?php
  require_once('DB.class.php'); 
  $db = new DB();
  $db-&gt;connect();
  $result=$db-&gt;SelectTable("multiple","","");
  ?&gt;
  &lt;table class=" table table-bordered table-hover" border="1" align="center" width="50%"&gt;
  &lt;tr&gt;
  &lt;th&gt;&lt;strong&gt;Sr.No.&lt;/strong&gt;&lt;/th&gt;
  &lt;th&gt;one&lt;/th&gt;
  &lt;th&gt;two&lt;/th&gt;
  &lt;th&gt;Equal&lt;/th&gt;                              
  &lt;/tr&gt;       
  &lt;?php
  if(count($result) &gt; 0)
  {
  foreach($result as $rslist12){
  ?&gt;
  &lt;tr&gt;
  &lt;?php $i =$i+1;
  ?&gt;
  &lt;td align="center" &gt;&lt;?php echo $i;?&gt;&lt;/td&gt;
  &lt;td align="center"&gt;&lt;input type="text" name="one" id="one"  style="width:60px;" value="&lt;?php echo $rslist12['one'];?&gt;" onchange="taxapply()";&gt;&lt;/td&gt;
  &lt;td align="center" &gt;&lt;input type="text" name="two" id="two"  style="width:60px;" value="&lt;?php echo $rslist12['two'];?&gt;" onchange="taxapply()";&gt;&lt;/td&gt;
  &lt;td align="center" &gt;&lt;label id="equal"&gt;&lt;input type="text" name="equal" id="equal" style="width:50px;"   value="&lt;?php echo $rslist12['equal'];?&gt;" onchange="taxapply()";&gt;&lt;/label&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php
  }
  }
  ?&gt;  
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;html&gt;  
  </code></pre>
  
  <p>DB.class.php</p>
  
  <pre><code>&lt;?php
  class DB {
  protected $db_name = 'plus2net';
  protected $db_user = 'root';
  protected $db_pass = '';
  protected $db_host = 'localhost'; 
  function __construct() {  
  $connection = mysql_connect($this-&gt;db_host, $this-&gt;db_user, $this-&gt;db_pass);
  mysql_select_db($this-&gt;db_name);
  
  return true;
  }  
  public function connect(){
  $connection = mysql_connect($this-&gt;db_host, $this-&gt;db_user, $this-&gt;db_pass);
  mysql_select_db($this-&gt;db_name);
  
  return true;
  }
  public function processRowSet($rowSet, $singleRow=false)
  {
  $resultArray = array();
  while($row = mysql_fetch_assoc($rowSet))
  {
  array_push($resultArray, $row);
  }
  
  if($singleRow === true)
  return $resultArray[0];
  
  return $resultArray;
  }
  public function SelectTable($table, $where="",$fieldarray="",$debug="") {
  if ($fieldarray=="")
  {
  $f_list = "*";
  }
  else
  { 
  $f_list = $fieldarray ;
  }
  $sql = "SELECT $f_list FROM $table ";
  if(  ! empty( $where ) )
  $sql .= " WHERE  $where";
  
  if($debug==1){echo $sql;exit();}
  $result = mysql_query($sql);
  if( ! $result )
  return 0;
  return $this-&gt;processRowSet($result);
  }
  public function SelectSingle($table, $where,$fieldarray="",$debug="") {
  if ($fieldarray=="")
  {
  $f_list = "*";
  }
  else
  { 
  $f_list = $fieldarray ;
  }
  $sql = "SELECT $f_list FROM $table ";
  if(  ! empty( $where ) )
  $sql .= " WHERE  $where";
  
  if($debug==1){echo $sql;exit();}
  $result = mysql_query($sql);
  if( ! $result )
  return 0;
  if(mysql_num_rows($result) == 1)
  return $this-&gt;processRowSet($result, true);
  }
  public function Update($table,$where,$data,$debug="") {
  
  foreach ( $data as $column=&gt;$value )
  {
  if($value !="now()"){
  $fv[] = "$column = \""."$value"."\"";
  }else{
  $fv[]= "$column = "."$value"."";
  }
  }
  $fv_list = trim(implode(", ", $fv));
  
  $sql = "UPDATE $table SET "."$fv_list"." WHERE $where";
  if($debug==1){echo $sql;exit();}
  mysql_query($sql) or die(mysql_error());
  return true;
  }
  public function Insert($table,$data,$debug="") {
  
  $columns = "";
  $values = "";
  foreach( $data as $column=&gt;$value )
  {
  $field[] = $column;
  if($value !="now()")
  $values[] = "'$value'";
  else
  $values[] = "$value";
  }
  $columns = trim( implode(", ", $field) );
  $values = trim( implode(", ", $values) );
  
  $sql = "insert into $table ($columns) values ($values)";
  if($debug==1){echo $sql;exit();}
  mysql_query($sql) or die(mysql_error());
  
  //return the ID of the user in the database.
  return mysql_insert_id();
  
  }
  public function Delete($table, $condition)
  {
  
  $query = "DELETE FROM $table WHERE $condition";
  $result = mysql_query( $query);
  if( ! $result )
  return 0;
  return 1;
  }
  
  }
  ?&gt;
  </code></pre>
  
  <p>Database</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `multiple` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `one` int(11) NOT NULL,
  `two` int(11) NOT NULL,
  `equal` int(11) NOT NULL,
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  INSERT INTO `multiple` (`id`, `one`, `two`, `equal`) VALUES
  (1, 2, 2, 4),
  (2, 4, 4, 16);
  </code></pre>