本文介紹了在 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
);
這篇關于在 PHP 中禁用添加選項的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!