Discussion on EditMe


jimmiw does not currently provide support for this item.

12 comments found.


Didn’t really know that one existed.

Anyways, the component i’ve made looks a bit different. Else the functionality seems similar.


We have been looking at inline editing, specifically jeditable type stuff.

My question.

We have a form submitted to the database.

We need to allow editing changes to be made in future for or clients, whereby they can retrieve their form from database, and make edits inline and save, back to the database.

Is this dooable.

Can you rig up an example, that actually uses database saving and editing. Rather than just pre filled forms, and cookies.


Hey, Sure.. the example will be kinda crude though, else it would take up too much space.

Two files used, first one is the one with the editme component: index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  <title>EditMe demo</title>
  <script src="jquery-1.4.2.min.js" type="text/javascript"></script>
  <script src="jquery.editme.js" type="text/javascript"></script>
  <link href="editme.css" rel="stylesheet" type="text/css" />

&lt;?php /** 
 * I just created a database called editme_test on my localhost.
 * The table I used was kinda simple... just test :)
 * create table stories (
 *   id int primary key auto_increment,
 *   title varchar(255)
 * );
 * since this is a REALLY simple example, insert some data so we have an ID etc
 * insert into stories(title) values('test title');
// hooks up the database connection

// fetches out the data
$query = mysql_query("select title, content from stories where id = 1");
// Takes the data into the row variable
$row = mysql_fetch_array($query);


<label for="title">Title</label><br />
<input name="title" value="&lt;?=$row['title'];?&gt;" type="text" /><br />

<script type="text/javascript">
$(document).ready(function() {
    autosave: function(data) {
      $.post('save_data.php', {
          'id': '1',
        }, function(response) {
          if(response == "") {
            // data was saved, call the "saved" function
          else {
            // data was not saved, show an error 


And here is the file that receives the data: save_data.php

<?php // fetches the post data
$id = $_POST['id'];
$field = $_POST['field'];
$data = $_POST['data'];

// hooks up the database connection

// constructs the sql we are to use.
$sql = "update stories set {$field} = '{$data}' where id = {$id}";
// executes the query

// if we have an error, show it!
if(mysql_error() != "") {
  echo mysql_error();

Hope you can use it… still, just a tad crude.

Can I update content from database? If yes, can you provide an example? Thank you!


See the example for SportTipWorld, should be something like that right ?


I was wondering if there was a way to tell which input is passing the data? I am looking to use this on a large form and would like to take advantage of the autosave feature. Long story short, I am looking to have editme look at all of the $(‘input’) items as a whole and not specifically have to write each form element out.

For example: - the method you denoted already looks to do a ajax post, but you are specifically denoting what the name of the post is in regards to the data ( ‘data’:data, )

My question is if there is something that knows which input is posting the autosave so that it can be used as a global on the form?

$(document).ready(function() { $(‘input’).editme({ autosave: function(data) { $.post(‘save_data.php’, { ‘id’: ‘1’,


}, function(response) {



Currently there is no way of knowing what item is being updated. I’ll make an updated version soon, that sends the item that was updated with the autosave function.

Hello jimmiw!

Your script is great, it does what it says and it is easy to install.

I have just two questions: Is it a way to make it work with textarea? Or are you planning to develop a textarea version in the future?


Hello Cadence96!

Currently i’m not thinking about extending the script to handle more html elements. But it’s a good idea that I might do a bit later.

Glad you like the script

- Jimmiw

Hi Great File!

But what about your update concerning the item detection to autosave different input text?


Hello Mike,

I’m not sure I follow you, what update?

The one about the textarea as well or ?

do you support dropdown be for i purchase


Currently only input fields are supported.

I think i’ll do an update to the script someday soon though, since textareas are also requested.

Hi Jimmin nice script, simple and efficient… Can you provide an example as you have done to update the database with both input AND textarea ? Many thanks, Vincent


Do you have an example (with code) inserting and updating using MySql?

This code above still works?


The example @Australia still works.

I Made a few adjusts but it worked :) thanks!

How Does it become “only the administrator can edit”?

Don’t load the script…

As usually, simplicity makes it perfect

Great Work! Good Luck!!!