I am making a check to see if the user account is freeze, this is in my database, $r is where I am getting the user data (name, freeze account, etc).
So if the freeze account is set to be 0 then I am showing a unchecked box otherwise a checked box. It works fine, however my question is how could I save it if I checked the box to say that the user account is freeze.
I know how to write the query if they check the box to say that the user account is freeze, just calling this function :
function updatefreezeaccount(){
mysql_query("UPDATE `users` SET `freeze_account` = 1 WHERE `user_id` = '$user_id'");
}
This is my code so far :
<?php
if ($r['freeze_account'] == 0) {
echo '<div class="example">
<input type="checkbox" unchecked data-toggle="toggle">
</div>';
}
else {
echo '<div class="example">
<input type="checkbox" checked data-toggle="toggle">
</div>';
}
?>
However I don't know how to make the check to see if the user has checked the box or not, any suggestion would be appreciated, thanks
Aucun commentaire:
Enregistrer un commentaire