我正在构建一个表,我想从中更新数据库的不同字段。输出当前值,然后是提交按钮和用于输入新值的文本字段。
当我为某个字段输入新值时,我希望该文本字段的提交按钮能够自动获得焦点,以便能够简单地按 ENTER 来更新数据库。这是如何实现的?我认为简单的HTML必须是可能的。这是一段代码:
echo "
<form method='post'>
<table>
<tr>
<th>Amount to receive</th>
<td>" . mysql_result($result, 0, "amountToReceive") . "</td>" . "
<td><input type='submit' value='Change' name='btnChangeAmountToReceive'> <input type='text' name='txtChangeAmountToReceive'></td>
</tr><tr>
<th>Amount received</th>
<td>" . mysql_result($result, 0, "amountReceived") . "</td>" . "
<td><input type='submit' value='Change' name='btnChangeAmountReceived'> <input type='text' name='txtChangeAmountReceived'></td>
</tr>
</table>
</form>";