I have a page that present a big table in my SQL DB, and every cell is an HTML input. The goal is to make a editable sql table that update my SQL DB based on changed in specific cell in big table form. I tought about making a script that trigger a JS function when a cell-change occurs, that update the specific change. Is it possible? Any other idea?
This is a draft of my idea. The issue is the While loop that present the table
<script>
$(document).ready(function(){
$('#testnum').on('change', 'input', function(){
$.post("getter.php",{###Don't know what to put here###);
});
});
</script>
<?php
while($res=mysqli_fetch_array($result))
{
echo "<tr>
<td onchange='changeit(fin)'>
<div name='fin' style='display:none;'> ".$res['first'] ."</div>
<input type='int' value=".$res['first'].">
</td>
<td onchange='changeit(sta)'>
<div name='sta' style='display:none;'>".$res['second']."</div>
<input type='int' value=".$res['second'].">
</td>
<td>";
?>
EDIT
For example - how can I pass David's ID if I change his city? (This table printed with WHILE statement)
ID name city
-------------------
1 David NY
--------------------
2 John LA
-------------------
3 Adam NJ
if I change David's city to "London" for example I want to send 3 things:
1) The ID - so I know which specific row. (in this case - "1")
2) The column name - so I can know which column has changed. (in this case - "city")
3) The data after change - so I know what to update. (in this case - "London")