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.
<?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);
?>
<html>
<body>
<table width="600" border="1" cellspacing="1" cellpadding="1">
<tr>
<th>Name</th>
<th>Roll No.</th>
</tr>
<?php
while($arr=mysql_fetch_assoc($rec))
{
echo "<form action=untitled2.php method=post>";
echo "<tr>";
echo "<td>"."<input type=text name='name' value='".$arr['name']."'>"."
</td>";
echo "<td>".$arr['rno']."</td>";
echo "<input type=hidden name='rno' id='rno' value='".$arr['rno']."'>";
echo "<td>"."<input type=submit value='update'>"."</td>";
echo "</tr>";
echo "</form>";
}
?>
</table>
</body>
</html>