php - Automatically update SQL database when checkbox clicked -
i'm using php list out table sql database, , each of rows have checkboxes in them user keep track of whether or not part of row complete or not. i'd when checkbox checked or unchecked, sql database automatically update. possible, or need "save data" button @ end of each row?
edit: clarify, i'm using php. if set onclick action of checkbox php/updatecheckbox.php?id=...
, how know value of checkbox? also, wouldn't force page refresh?
try this
$fet['id'] id fetched db intimate modify.
<a href=#><input type="checkbox" onclick="myfunction('.$fet['id'].');"> </a> <script> function myfunction(del) { var rmvfile=del; if (confirm("are sure want delete file?") == true) { if(del!='') { $.ajax({ type:'post', url:'query4.php', data:{rmvfile: rmvfile}, success:function(msg){ } }); } } } </script>
create page query4.php
<?php include "config.php"; $s=$_post['rmvfile']; $sel="update register set log=1 id='".$_post['rmvfile']."'"; //your query $sel1=mysql_query($sel); ?>
Comments
Post a Comment