The html_options method in smarty generates a select drop-down list in the template, which id can be initialized to be selected. See the following code: the html_options method in the php part of smarty generates a select drop-down list in the template, which id can be initialized to be selected? See the following code:
Php section
$ SQL _sysuser = "select * from tuser where tuser_status = '1' order by tuser_truename ";
$ Rs_sysuser = $ db-> SQL _query ($ SQL _sysuser );
While ($ row_sysuser = $ db-> SQL _fetchrow ($ rs_sysuser )){
$ Usersys [$ row_sysuser ['tuser _ name'] = $ row_sysuser ['tuser _ truename'];
}
Html section
<{Html_options options = $ sysUser}>
It can be seen that the html_options of smarty actually accepts an array, and this array still requires dropping ~
The key value of the array will be the value of option, and the value of the array will be the value of option. if you need to set a value in the initial status to the selected status
Html_options also has a usage. The value of option is separated from the display, so that you can easily handle other situations.
The usage is as follows:
Index. php:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.