I have this code:
<?php
if(isset($_POST['submit'])) {
if(isset($_POST['sharks'])) {
$_SESSION['value'] = $_POST['sharks'];
} else {
$_SESSION['value'] = '';
}
}
?>
<form action="" method="POST">
<?php
echo '<input name="sharks" type="checkbox" value="1" id="sharks" ';
if ($_SESSION['value'] == 1) {
echo ' checked="checked"';
}
echo ">";
?>
<br>
<button type="submit" name="submit" value="Save">Salva</button>
</form>
I'm already inside a loop of users, I just want to add a checkbox next to them and save the value of that checkbox connected to that user.
When I try to save the checkbox this is what happen:
Thank you all
UPDATE:
This image can help a lot:
https://i.imgur.com/vXjSqcF.png
This is the table I have, I just want to add a checkbox next to every user and save the status of them.