Why don't you want to use the jQuery to send modifications to PHP?
It will be simpler as you are already using jQuery to modify content. At the end of your snippet add following method
$.post('path/to/php-file.php', {
nameOfVar1 : 'valueToSend',
nameOfVar2 : varToSend
}, function (data) {
/* What to do on success */
});
You can read more about it here http://api.jquery.com/jQuery.post/
Example:
You can write single function to handle everything. Of course you can use other approach which is more suitable in your context. Sample function would be:
function updateContent(content, table, column) {
$.post('update.php', {
content : content,
tableName : table,
columnName : column
});
}
And the call the functions whenever you need it. You will pass $('#element').text() as content. On the server side you will use following SQL to update your contents:
$sql = "UPDATE $_POST['tableName']
SET $_POST['columnName']=$_POST['content']";
Of course this is pure example and server side code is not safe for SQL injections. You must check posted values and escape string.
You can use this example to build javascript functions which will be more appropriate for your context.