我有一个使用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