在 PHP 中禁用添加选项
我在 PHP 中有一个带有下拉字段的表单,带有这个数组:
I have a form with a dropdown field in PHP with this array:
$field["options"] = array(
array("value" => "Chişinău", "text" => "Chişinău", "depth" => 0),
array("value" => "Bălţi", "text" => "Bălţi", "depth" => 0),
array("value" => "Comrat", "text" => "Comrat", "depth" => 0),
...
array("value" => "Ungheni", "text" => "Ungheni", "depth" => 0)
);
如何将添加为第一个选项?
How to add as a first option the <option selected disabled>Choose one</option>
?
推荐答案
$field["options"] = array(
array("value" => " ", "text" => "Choose one", "depth" => 0, "selected" => "selected", "disabled" => "disabled"),
//...rest other option code
);
相关文章