This is my database
<?php
if(isset($_POST["insert"]))
{
$conn = mysqli_connect("localhost", "root", "", "databaseappfeature");
if(isset($_POST["insert"]) == "1"){
$query = "UPDATE appfeature SET feature_switch = ('".$_POST["insert"]."')";
$result = mysqli_query($conn, $query);
echo "Data Inserted Successfully!";
}
}
?>
This is my javascript code
<script>
$(document).ready(function(){
$('#submit').click(function(){
var insert = [];
$('.get_value').each(function(){
if($(this).is(":checked"))
{
insert.push($(this).val());
}
});
insert = insert.toString();
$.ajax({
url: "insert.php",
method: "POST",
data:{insert:insert},
success:function(data){
$('#result').html(data);
}
});
});
});
</script>
This is my checkbox code
<form action="" method="POST">
<h4 id="result"></h4>
<div class="container">
<h2 align="center">Table App Feature</h2>
<table id="appFeature" class="table table-hover" align="center" style="width:500px;margin:auto;">
<thead>
<tr>
<th>Firstname</th>
<th>Please check to enable the features</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smarthome</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Intercom</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Visitors</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Booking</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Access</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Parcel</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Bills</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Invoices</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
<tr>
<td>Receipts</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Transactions</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Meeting</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
<tr>
<td>Vote</td>
<td>
<input type="checkbox" class="get_value" value="1"/>
</td>
</tr>
<tr>
<td>Feedback</td>
<td>
<input type="checkbox" class="get_value" value="1" />
</td>
</tr>
</tbody>
</table><br />
<div align="center">
<button type="button" name="submit" id="submit">Update</button>
</div>
</div>
</form>
How can i update the value of multiple checkbox into the database and the value should be 1 if the checkbox is checked and 0 if the checkbox is unchecked?? This is my checkboxThis is jquery that i use to pass the value of checkboxThis is my database code Please help me..i'm very new to this..and i'm doing this for a week..