Hello, 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>
Interestingly, before this line, echo($currentperms['newapp'])
gives 0, as per what's set in the database, however, after this line, echo($currentperms['newapp'])
gives 1, indicating that the variable has changed.
What could the reason be for this?
I've tested the code, and it is these lines which are redefining the variables, and is preventing me from completing the script, as I can't test it's functionality.
I've checked that $currentperms['newapp'] = "0"
:
Array ( [userid] => 1 [ptodo] => 1 [usercp] => 1 [pm] => 1 [bug] => 1 [abug] => 1 [admincp] => 1 [intmgs] => 1 [adduser] => 1 [pass] => 1 [useredit] => 1 [listuser] => 1 [newapp] => 0 )
Thanks :)