Enable/disable the setting of the default value of this option
**军
**军 2019-02-21 22:55:45
0
5
1215
The name="status" form in

admin_edit.html is enabled or disabled by default. It will not change due to the status value of the database. I made the following judgment for this form. The result cannot be displayed. Why and how to obtain it? status and display the value in the edit page

{eq name="$user_info.status" value=1}
<option value="1" selected>Enable</option>
<option value="0" >Do not enable</option>
{else /}
{eq name="$user_info.status" value="0"}
< ;option value="1">Enable</option>
<option value="0" selected >Disable</option>
{/eq}
{/eq}

**军
**军

reply all(3)
Peter-Zhu

If you look at the source code, this enabling and disabling function should not be done, it just provides an entrance.

  • reply You know, I added it myself, just by following the above method. There are bugs in some parts of the source code. It would be more conducive to learning if you deal with it yourself. The code is basically repetitive, and it makes your head hurt to look for bugs.
    **军 author 2019-02-23 06:17:16
何勇军

First of all, because the getter changes the values ​​​​of 0 and 1 into enabled/disabled/administrator/super administrator strings, the value here is the above value instead of 0 and 1, and the value in option It should be exactly the same as the string above

何勇军

The reason for not displaying is found. Because the value of value is a string, and the value of $user_info.status is 1 or 0, so the selected ones will be judged as false and will not be displayed. So how to change the status of the database? What about passing the value into the pop-up admin_edit.html?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!