<table cellspacing="0" style="font-size:15px;" width="100%" align="center" id="sl">
<p class="a">Custom Subsidiary</p>
<INPUT type="button" value="Add" onclick="addRow('sl')" style="font-family: 'icomoon';
font-size: 12px;content: \e608;"/>
<tr style="" width="100%">
<th style="border-bottom: black 2px solid;"></th>
<th style="border-bottom: black 2px solid;text-align:left;" valign="left">Key</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">Description</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">City</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">Address</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">Address</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">Zipcode</th>
<th style="border-bottom: black 2px solid;text-align:left;" align="left">Municipal</th>
</tr>
<?php
$c=1;
$sq=mysql_query("select * from subsidiaryledger");
while($re=mysql_fetch_array($sq))
{
?>
<tr>
<td align="left"><?php echo $c;?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'keyss','<?php echo $re[0]; ?>')"><?php echo $re[1];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'description','<?php echo $re[0]; ?>')"><?php echo $re[2];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'city','<?php echo $re[0]; ?>')"><?php echo $re[3];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'address','<?php echo $re[0]; ?>')"><?php echo $re[4];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'address1','<?php echo $re[0]; ?>')"><?php echo $re[5];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'zipcode','<?php echo $re[0]; ?>')"><?php echo $re[6];?></td>
<td style="font-family: erpag,Segoe UI;
font-weight: bold;
font-size: 11px;" align="left" contenteditable="true" onBlur="saveToDatabase(this,'municipal','<?php echo $re[0]; ?>')"><?php echo $re[7];?></td>
<td><a href="subsidiaryledger.php?id=<?php echo $re[0];?>&st=del"><img src="delete.png"></a></td>
</tr>
<?php
$c++; }
?>
</table>
<script type="text/javascript">
function saveToDatabase(editableObj,column,id) {
$(editableObj).css("background","#FFF url(loaderIcon.gif) no-repeat right");
$.ajax({
url: "saveedit.php",
type: "POST",
data:'column='+column+'&editval='+editableObj.innerHTML+'&id='+id,
success: function(data){
$(editableObj).css("background","#FDFDFD");
}
});
}
</script>
saveedit.php
<?php
include("../db.php");
mysql_query("UPDATE subsidiaryledger set " . $_POST["column"] . " = '".$_POST["editval"]."' WHERE id=".$_POST["id"]);
?>