Question

I want to implement the auto save form.

  1. I open the new form link new-form.php
  2. Type the title then after 10 seconds it's save to database.
  3. Then I continue typing the whole form.
  4. Here, what is the key to update the previous saved content? And I'm still on new-form.php

What is the logic to save new entry & update after auto save.

Let me know.

Was it helpful?

Solution

first of all you can take a hidden field in form for ex. form_id initially it will be blank, it means it will create form.. when first time form saves it will be inserted to database. and then you return newly inserted id of the form to ajax response on ajax success you can set the hidden field value to newly created form id and now if id of form is passed to php scritp then you can use update query. else insert query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top