I am using addtion method in checkbox using php dynamically value coming from database in checkbox value. if i am clicking checkbox the value is adding the values. i was getting the alert values in confirm button. how to pass that value in php. please suggest me
index.php
<input class="checkbox" type="checkbox" name="select" value="<?php echo $row['values'];?>">
<input type="submit" class="button" onclick="insert()" name="check" value="Confirm ">
javascript
<script>
function insert(){
var el, i = 0;
var total = 0;
while(el = document.getElementsByName("select")[i++]) {
if(el.checked) { total= total + Number(el.value);}
}
//alert(total);
}
</script>