我在PHP中有一个带有下拉字段的表单,其中包含以下数组:
$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)
);
如何添加<option selected disabled>Choose one</option>
作为第一个选项?
答案 0 :(得分:2)
$field["options"] = array(
array("value" => " ", "text" => "Choose one", "depth" => 0, "selected" => "selected", "disabled" => "disabled"),
//...rest other option code
);