<script>
let checked = <?php echo $row["restriction"] ?>;
console.log(checked);
</script>
When I was using a JS variable with let to store a php value, this output appears with errors:
1
userManage.php:88 Uncaught SyntaxError: Identifier 'checked' has already been declared (at userManage.php:88:49)
userManage.php:109 Uncaught SyntaxError: Identifier 'checked' has already been declared (at userManage.php:109:49)
userManage.php:130 Uncaught SyntaxError: Identifier 'checked' has already been declared (at userManage.php:130:49)
The console.log only runs once then the three other values get an error.
After replacing let -> var, then there's clearly nothing wrong
<script>
var checked = <?php echo $row["restriction"] ?>;
console.log(checked);
</script>
Output:
1
1
1
0
0
let checked = ...in the page. As C3roe says, you cannot declare multiple variables using the same name in the same scope, if you declare them withlet.checkedisn't output by PHP as far as I can make out. If that was happening, the error would be different than the one the OP is reporting.