Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7749861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:08:31+00:00 2026-06-01T11:08:31+00:00

I need help with auto-saving a textarea. Basically, whenever a user is typing in

  • 0

I need help with “auto-saving” a textarea. Basically, whenever a user is typing in the textarea, I would like to save a “draft” in our database. So for example, a user is typing a blog post. Every 15 seconds I would like for the script to update the database with all text input that was typed into the textarea.

I would like for this to be accomplished thru jQuery/Ajax but I cannot seem to finding anything that is meeting my needs.

Any help on this matter is greatly appreciated!

UPDATE:

Here is my PHP code:

<?php

$q=$_GET["q"];
$answer=$_GET["a"];

//Connect to the database
require_once('mysql_connect.php') ;

$sql="UPDATE english_backup SET q".$q."='".$answer."' WHERE student_id = {$_COOKIE['student']} LIMIT 1";
$result = mysqli_query($dbc, $sql);

?>

Here is my javascript code:

<script type="text/javascript">
function showUser(str, answer)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getuser_english.php?q="+str+"&a="+answer,true);
xmlhttp.send();
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:08:32+00:00Added an answer on June 1, 2026 at 11:08 am

    I think you want something like ajax… I’m using ajax jQuery so you will need jQuery Library for it to work. Download it. You can find tutorials on the documentation tab of the website.

     //in your javascript file or part
    $("textarea#myTextArea").bind("keydown", function() {
            myAjaxFunction(this.value) //the same as myAjaxFunction($("textarea#myTextArea").val())
    });
    
    function myAjaxFunction(value) {
        $.ajax({
            url: "yoururl.php",
            type: "POST",
            data: "textareaname=" + value,
            success: function(data) {
                if (!data) {
                    alert("unable to save file!");
                }
            }
        });
    }
    
     //in your php part
     $text = $_POST["textareaname"]; 
     //$user_id is the id of the person typing
     $sql = "UPDATE draft set text='".$text."' where user_id='".$user_id."'"; //Try another type of query not like this. This is only an example
     mysql_query($sql);
     if (mysql_affected_rows()==1) {
        echo true;
     } else echo false;
    

    Hey everyone I’m still having a problem please see here https://stackoverflow.com/questions/10050785/php-parse-html-using-querypath-to-plain-html-characters-like-facebook-twitter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

need help in error in database pivot. i have table tamed table_score like below:
I need you help with the auto rotate function in Xcode. I have designed
I have a small database that I need help designing. I have a VB.NET
I need some help with a CSS layout. It is set up like this:
I need help centering an image inside a container with overflow:auto after enlarging the
I need help with auto slider animation.So, my question is - how to stop
Hi i need help with refreshing div, but not auto refresh! I have my
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.