title: get id of each row's content at button click
body: <p>I have two pages. in one page i get data from database and show the product's name, address and etc. and each one of products have a button, show details. when button clicked it should redirect to another page for example 2.php and grab the selected row's product id and send it to another page and show details of products there. I want to use query string but when I click at more details at each row, it only shows the last row's details.
  I searched a lot but could not solve the problem.
  here is my code:</p>
  
  <pre><code> echo '&lt;form id="formsell" method="post" action="2.php?fid='.$_POST['fid'].'&gt;';
    $r=mysql_query("select melk.melk_id,melk.melktype,melk.city,melk.khiaban,melk.area,melk.darjdate
   ,villa.room_count,villa.floor_count,villa.floor_number, foroosh.price from melk
   inner join villa on melk.melk_id=villa.melkid inner join foroosh on villa.melkid=foroosh.melkid where contracttypeid='1' and melktypeid='1' ");
   echo mysql_error();
   echo "&lt;div class='items'&gt;";
  
  while($row=mysql_fetch_array($r))
  { 
  echo "&lt;div class='itemcont'&gt;
  &lt;div class='m_sum'&gt;
  &lt;div style='width:180px; height:auto; overflow:hidden; text-align:center; direction:rtl; float:right;'&gt;
  &lt;h1 class='redtitr'&gt;$row[city]   $row[khiaban]&lt;/h1&gt;
    مساحت:  &lt;span class='text'&gt;$row[area]&lt;/span&gt;  متر   &lt;br/&gt;
  تعداد اتاق:  &lt;span class='text'&gt;$row[room_count]&lt;/span&gt;";
  echo "&lt;input type='hidden' name='fid' id='$row[melk_id]' value='$row[khiaban]' /&gt;
   &lt;span style='color:#0054a0; margin:6px auto; padding-top:10px; font-size:16px; text-align:center; background:url(../img/pdGreyDivider.jpg) repeat-x left top; font-weight:bold; display:block;'&gt;";
   echo hyphenate($row[price]);
   echo "
   &lt;/span&gt;&lt;span class='text'&gt;تومان&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;input type='submit' value='جزئیات بیشتر' name='sdetail' id='sdetail'/&gt;
    }
  
  
   if (isset($_POST['sdetail']))
     {
      $_POST['fid'];
     }
  </code></pre>
  
  <p>and in 2.php and I will show details with the id:</p>
  
  <pre><code>&lt;?php 
  echo $_GET['fid'];
  ?&gt;
  </code></pre>