我有一個使用MySQL查詢動態生成的網頁的一部分:如何從動態創建的網頁更新數據庫? PHP MySQL的
<table id="livePlayers" cellpadding="4" align="center">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Phone number</th>
<th>Email Address</th>
<th>Rating</th>
</tr>
<?php
while ($currLine = @mysql_fetch_array($resultSet))
{
$phoneCount= "phone".$count;
$ratingCount= "rate".$count;
?>
<tr>
<td><?php echo $currLine[1]?></td>
<td><?php echo $currLine[2]?></td>
<td><input type="text" name="<?php echo $phoneCount ?>"></td>
<td><?php echo $currLine[0]?></td>
<td><input type="text" name="<?php echo $ratingCount ?>"></td>
</tr>
<?php
$count++;
}
?>
</table>
正如你可以看到,2場是input type="text"
。一旦用戶在這些字段中輸入內容,我需要使用這些值更新數據庫表,單擊提交。
但是,我不明白如何做到這一點,因爲name
將是動態生成的。有沒有辦法用輸入的值更新相應的行?
'name'應該是靜態的,應該值存儲在'value' attibute – diEcho 2011-06-03 16:51:43