这是我的代码,当我显示基于no的文本字段。从我的查询得到的数据,
例如,它显示6个文本字段和用户改变的值,当我点击提交我怎么能提交值到php和更新我的数据库?
while ($row=mysql_fetch_assoc($results)){
echo '<tr>';
echo '<p ><input class ="tb8" type= "text" value="'.$round.'" name="percent" id="percent'.$y.'" /><span class="currencyinput">%</span></p>';
echo '</tr>';
}
这是我的按钮:
<input style="font-weight:bold" type="Submit" class="rad-button xsmall light flat" name="Submit" value="SAVE" id="start_button"/>
您编写的查询要更新。由于你提供的数据不完整…我的查询不完整。
<form method='POST' action='Submit.php'>
<?
while ($row=mysql_fetch_assoc($results))
{?>
<tr>
<p>
<input class ="tb8" type= "text" value="<?echo $round;?>" name="percent[]" id="percent<?echo $y;?>" />
<span class="currencyinput">%</span>
</p>
</tr>
<?}?>
<input type='submit' value='submit'>
</form>
Submit.php
$TotalPercentBox=$sizeof($percent);
for($i=0;$i<$TotalPercentBox;$i++)
{
$Percent=$percent[$i];
//It will get incremented till condition fails. Now, you will have 6.
$Query="UPDATE TableName SET ColumnName='$Percent' WHERE (Some Condition)"
//Execute Query Here...
}