javascript - Trying to save the contents of a contenteditable div to MySQL database -


OK, so I want to submit the content of a contentedable div into a MySQL database. I have a (contenteditable = 'true') population with a HTML code from a MySQL database. This is something like this:

  $ page = $ _GET ['page']; $ Getpage = mysql_query ("WHERE title = '$ page'" from the page) or die (mysql_query ()); $ Line = mysql_fetch_assoc ($ getpage); $ Pagecode = $ line ['pagecode']; & Lt; Div class = "editable" contenteditable = "true" & gt; & Lt ;? Php echo $ pagecode; ? & Gt; & Lt; / Div & gt;  

And I want to control it with regular links:

   

It may be possible to work with a hidden form that is controlled with Javascript, but I have no clue.

The goal is to do something like HTML Editor, display HTML code from the database within the editable device, and allows the user to edit it and save it back to the database.

Gill

In your AJAX code, request a new AJAX for a processor . Assign id = 'id_name_here to your div and pass id_name_here.innerHTML on the URL. Then you can do something with your processor.

  // js function a function () {var updated_div_info = document.getElementById ('id_name_here'). InnerHTML; // Posted to AJAX ...} // PHP & lt ;? Php $ updated_div_info = $ _POST ['updated_div_info']; // include in DB  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -