title: Updating data dyanamically using php
body: <p>The values are not updated in mysql database while using the following code.
  I wanted to update database hell with the new values entered in textbox. </p>
  
  <pre><code>    &lt;?php
      $con=mysql_connect("localhost","host","pass");
      mysql_select_db("Host",$con);
      if(isset($_POST['update'])){
      $upd= "UPDATE hell SET name='".$_POST['name']."'
      WHERE rno='".$_POST['rno']."'";
      mysql_query($upd,$con);
      }
      $sql="SELECT * FROM hell";
      $rec=mysql_query($sql,$con);
      ?&gt;
      &lt;html&gt;
      &lt;body&gt;
      &lt;table width="600" border="1" cellspacing="1" cellpadding="1"&gt;
      &lt;tr&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Roll No.&lt;/th&gt;
      &lt;/tr&gt;
      &lt;?php
      while($arr=mysql_fetch_assoc($rec))
      {
      echo "&lt;form action=untitled2.php method=post&gt;";
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;"."&lt;input type=text name='name' value='".$arr['name']."'&gt;"."
      &lt;/td&gt;";
      echo "&lt;td&gt;".$arr['rno']."&lt;/td&gt;";
      echo "&lt;input type=hidden name='rno' id='rno' value='".$arr['rno']."'&gt;";
      echo "&lt;td&gt;"."&lt;input type=submit value='update'&gt;"."&lt;/td&gt;";
      echo "&lt;/tr&gt;";
      echo "&lt;/form&gt;";
      }
      ?&gt;
      &lt;/table&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>