制作一个新工具并需要一个下拉菜单,但它似乎不像我编码的那样工作。不确定到底是什么问题。已经在网上研究过,但我一直无法弄清楚。if(!isset($_POST["ReasonList"])) { $error .= '<p><label class="text-danger">Please select a reason</label></p>'; }<div class="form-group"><label>Select Reason for Request</label><select id="ReasonList" name="ReasonList" class="form-control" value="<?php echo $ReasonList; ?>" /> <option value = "">Select...</option> <option value = "1">Original Engineer has left the company</option> <option value = "2">Actively involved in field work on customer site</option> <option value = "3">No capacity due to customer mandated deadlines</option> <option value = "4">Exception request by manager</option></select></div>如果选择了选项,则可以提交表单。如果没有选择选项,它会在 if 语句中给出错误 - 请选择一个原因
1 回答
慕的地6264312
TA贡献1817条经验 获得超6个赞
查看更正后的<select>元素,以及代码缩进如何使 HTML 更易于阅读和调试。
<div class="form-group">
<label>Select Reason for Request</label>
<select id="ReasonList" name="ReasonList" class="form-control">
<option value = "">Select...</option>
<option value = "1">Original Engineer has left the company</option>
<option value = "2">Actively involved in field work on customer site</option>
<option value = "3">No capacity due to customer mandated deadlines</option>
<option value = "4">Exception request by manager</option>
</select>
</div>
该<select>元素没有value属性,并且您不小心关闭了<select>beforename属性。
- 1 回答
- 0 关注
- 154 浏览
添加回答
举报
0/150
提交
取消