Here's a snippet for the UI portion:
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript">
function convertToInput(containerId, link) {
$('#' + containerId).html("<input type='text' value='" + link.text + "' onBlur='saveNewValue(\"" + containerId + "\", this.value);' />");
}
function saveNewValue(containerId, val) {
$('#' + containerId).html("<a href='javascript:void(0);' onClick='convertToInput(\"" + containerId + "\", this);' >" + val + "</a>");
$.ajax({
url: "saveTheValue.php",
data: "value=" + val,
type: 'POST',
timeout: 1000,
error: function(){ alert('AJAX call timed out'); }
});
}
</script>
</head>
<body>
<div id="nameContainer">
<a href="javascript:void(0);" onClick="convertToInput('nameContainer',this);" >John Smith</a>
</div>
</body>
</html>
- <html>
- <head>
- <title>Example</title>
- <script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
- <script type="text/javascript">
- function convertToInput(containerId, link) {
- $('#' + containerId).html("<input type='text' value='" + link.text + "' onBlur='saveNewValue(\"" + containerId + "\", this.value);' />");
- }
-
- function saveNewValue(containerId, val) {
- $('#' + containerId).html("<a href='javascript:void(0);' onClick='convertToInput(\"" + containerId + "\", this);' >" + val + "</a>");
- $.ajax({
- url: "saveTheValue.php",
- data: "value=" + val,
- type: 'POST',
- timeout: 1000,
- error: function(){ alert('AJAX call timed out'); }
- });
- }
- </script>
- </head>
- <body>
- <div id="nameContainer">
- <a href="javascript:void(0);" onClick="convertToInput('nameContainer',this);" >John Smith</a>
- </div>
- </body>
- </html>
Two more things to be done. First, you need to populate the href with your original DB value (instead of John Smith). Second, you need to write the php page that will take the post $_REQUEST and save it back to the DB (in the script, the reference to this file is 'saveTheValue.php' so when you make your file, replace that with your file name).
I don't have a lot of time right now to set up and tear down a quick DB for testing, so I'm leaving those parts to you. I don't like giving turn-key solutions anyways, so consider the rest homework.

I'd love to change the world, but they won't give me the source code.