I am currently doing a website with PHP and HTML with connecting with mysql. I am struggling with the checked of the checkbox. The website is file management system where we can make a certain files be public and certain to be confidential. I have found some good answers in here but Idk why it could not work when I want to insert a new files and not the edited one.
my html
<div class="form-group">
<label for="is_public" class="control-label"><input type="checkbox" name="is_public" id="is_public"><i>Make this file accesible to all users</i></label>
</div>
is_public is a data from mysql where 1 means it is public and 0 is confidential. this checkbox is the same when you want to upload a new file.
this is how the data is inserted into mysql
if(isset($is_public) && $is_public == 'on')
$data .= ", is_public = 1";
else
$data .= ", is_public = 0";
anyone can help?
I have put php <?php if(isset($meta['is_public'], '1') !== false) echo 'checked="checked"';?>
after the id, it works for uploaded file when I want to edit it but it didnt work when i want to upload new file bcs they will appear error message.
Aucun commentaire:
Enregistrer un commentaire