I'm currently using checkboxes to set permissions within my PHP application. On the user management page, if the user has the permission, defined by 1 or 0 in the database, the box with be checked or unchecked respectively. Below is the code that is being used to check whether if the box should be checked or not:
<div><input type="checkbox" tabindex="1" name="permission[$app]" value="1" <? if ($currentperms['newapp'] = "1") {echo " checked ";}?> />New Application</label></div>
İlginçtir, bu satırdan önce, echo($currentperms['newapp'])
değişken değiştiğini belirten, ancak, bu satırdan sonra, echo($currentperms['newapp'])
1 verir, veritabanında ayarlanmış ne başına, 0 verir.
Nedeni, bu ne olabilir?
Ben kodu test ettik, ve ben bunun işlevselliği test edemez gibi, değişkenleri yeniden tanımlıyor ve senaryoyu tamamladıktan beni engelliyor, bu satır.
Ben kontrol ettik $currentperms['newapp'] = "0"
:
Array ([userid] => 1 [PTODO] => 1 [Forum Yöneticilerini] => 1 [pm] => 1 [bug] => 1 [ABUG] => 1 [admincp] => 1 [intmgs] => 1 [adduser] => 1 [pass] => 1 [useredit] => 1 [LISTUSER] => 1 [newapp] => 0)