In the search I've done about checkbox I've seen several alternatives for inserting checkbox values, using array methods and loops.
But I want to insert only 1, it is still necessary to use array and loops.
The following code is returning error, as best suited as possible.
<form method="post" action="trata_check.php">
<input id="" type="checkbox" name="um" value="um">Um
<input id="" type="submit" value="gogopls">
</form>
trata_check.php
<?php
include 'conect.php';
$um = $_POST['um'];
$sql =
"INSERT INTO part_1
(um)
VALUES
('$um')";
if ($con->query($sql) === TRUE) {
echo "realizado";
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
$con->close();
?>
I'm not finding a solution.