I want to make a Row with Checkbox. If the checkbox is not checked and you check the value is changed in SQL and the reverse too.
I have this:
<?php
if ($Row['vip'] == 1)
{
echo "<td style='text-align: center;' width='5%'><input type='checkbox' name='vip[]' value='1' checked='checked' /></td>";
}
else
{
echo "<td style='text-align: center;' width='5%'><input type='checkbox' name='vip[]' value='0' /></td>";
}
?>
Checkbox.php
<?php
require('config.php');
$iConnection = mysqli_connect($_HOST_,$_USER_,$_PASS_,$_MYDB_) or die("<link rel='stylesheet' type='text/css' href='css/style.css'><h4>Rank not found.</h4>");
if($checkbox1 = $_POST['vip'];
{
for ($i=0; $i<sizeof($checkbox1);$i++)
$query="INSERT INTO mytable (vip) VALUES ('".$checkbox1[$i]."')";
mysqli_query($iConnection, $query) or die (mysqli_error());
}
echo "Record is inserted";
}
?>
</div>