gpt4 book ai didi

php & mysql 下拉选项选择问题

转载 作者:行者123 更新时间:2023-12-01 00:00:02 25 4
gpt4 key购买 nike

当我尝试从下拉列表中的 sql 中选择选项时,我得到所有选项都被选中:

$status1 = $row7["status"];

if($status1 == "draft") { $slc = "selected"; }
if($status1 == "ordered") { $slc = "selected"; }
if($status1 == "shipped") { $slc = "selected"; }

echo "
<select class=\"form-control input-sm\" name = \"o_status\">
<option value = \"draft\" $slc>draft</option>
<option value = \"ordered\" $slc>ordered</option>
<option value = \"shipped\" $slc>shipped</option>
</select>
";

我的输出问题选择了所有这样的选项:

  <select class="form-control input-sm" name = "status">
<option value = "draft" selected>draft</option>
<option value = "ordered" selected>shipped</option>
<option value = "shipped" selected>shipped</option>

最佳答案

请立即检查。

希望对你有帮助:

$status1 = $row7["status"];

if($status1 == "draft") { $draft = "selected"; }
if($status1 == "ordered") { $ordered = "selected"; }
if($status1 == "shipped") { $shipped = "selected"; }

echo "
<select class=\"form-control input-sm\" name = \"o_status\">
<option value = \"draft\" $draft>draft</option>
<option value = \"ordered\" $ordered>ordered</option>
<option value = \"shipped\" $shipped>shipped</option>
</select>
";

关于php & mysql 下拉选项选择问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43205200/

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