'view_act.php' file
<?php
  $query = mysql_query('select * from activities');
   $check=mysql_num_rows($query);
  if($check==0)
   { 
   echo "No enteries found ";
   }
  else
  {  
     static $counter;
     echo '<table border="1" cellpadding="5" cellspacing="5" align="center">
      <tr>
      <th><font color="#FF9900">ACTIVITY NAME</font></th>
      <th><font color="#FF9900">ACTIVITY UPDATE</font></th>
     </tr>';
     while($row=mysql_fetch_array($query))
     { $counter++;
           echo '<tr>';
           echo '<td width=231>
      <form action="update_act.php" method="POST">';
       echo "<center><font color=\"#CC9900\">".$row['act_name']."</center>";
      echo "</td>
      <td width=231>";
      echo "<center>".'<font color="#CCCCCC"><input type="submit" name="edit"                                 value="edit"></center>';
      echo '<input type="hidden" name="act_name'.$counter.'" value="'.$row['act_name'].'" />';
      echo '<input type="hidden" name="count" value="'.$counter.'" />';
      echo "</td>
       </tr>";
     }
     echo "</form>";
    echo "</table>";
  }         
 ?> 
'update_act.php' file
 <?php
      $count=$_POST['count'];
  echo "Old Activity Name : ". $_POST["act_name".$count];
  echo '<br/>Enter new activity name :
       <form action="update_act.php" method="post">
          <input type="text" name="aname">
     <input type="submit" name="submit">'; 
  ?>
Here data fetched from the table has to be updated through a different name of edit button so for each Activity Name a different name is given by counter.But the problem here is when the form is submitted to the page update_act.php the value of last Activity Name is passed every time.So the value of old Activity Name for any row is the last value of the table 'act_name'.Please help me out to pass corresponding value of counter for any Activity Name.