gpt4 book ai didi

php - 更新数据库中的正确字段

转载 作者:行者123 更新时间:2023-11-29 08:20:56 25 4
gpt4 key购买 nike

我的表单中只有几个字段

<form action="?code='.$order_id.'" method="post">
<input type="text" name="length" placeholder="'.$row_order['length'].'">
<input type="text" name="breadth" placeholder="'.$row_order['breadth'].'">
<input type="text" name="width" placeholder="'.$row_order['width'].'">
<input type="submit" name="save" value="Save">
</form>

我从数据库中检索长度、宽度和宽度的值,并通过占位符显示它。现在我希望如果用户输入一些长度值,那么只有数据库中的长度字段会受到影响,其他字段完好无损。

现在,如果我将长度值设置为 50 并“保存”,那么它会显示长度=50、宽度=0 和宽度=0,即使我在更新之前有宽度=40 和宽度=30。

最佳答案

在输入标记中使用值代替占位符

<form action="?code='.$order_id.'" method="post"> 
<input type="text" name="length" value="'.$row_order['length'].'">
<input type="text" name="breadth" value="'.$row_order['breadth'].'">
<input type="text" name="width" value="'.$row_order['width'].'">
<input type="submit" name="save" value="Save"> </form>

关于php - 更新数据库中的正确字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19433456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com