This is an example of how HTML, JavaScript, PHP and MySQL work together. Pass your mouse over the red text to see what roll that identifier has.
 


in the web page index.html
in the server script data.php
<HTML>
   <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="check.js"></SCRIPT>
   <FORM NAME="likesForm" ACTION="data.php? do=save_text">
      <INPUT TYPE="text" NAME="my_new_text" VALUE="I like candy">
      <INPUT onClick="checkItOver()" TYPE="button" VALUE="Save">
   </FORM>
</HTML>
<?PHP
if($_GET['do'] == "save_text")
{
   $db_session = @mysql_pconnect("localhost", "dbuser", "dbpassword");
   mysql_select_db("ourstuff", $db_session);
   mysql_query("UPDATE mydata SET like=".$_POST['my_new_text']." WHERE id=1", $db_session);
}
?>





in the script check.js
in the database ourstuff in the table mydata
function checkItOver()
{
    textBox = getElementByName("my_new_text");
    if(textBox.length > 0)
    {
       document.likesForm.submit();
    }
}
     id        |             like
------------------------------------------------
      1        |      I like candy
      2        |      I like pizza