Using jEditable with jQuery, 'submit' function and php? How does this work?

Using jEditable with jQuery, 'submit' function and php? How does this work?


Under the 'style' section I can add a 'submit: whatever'. I've seen someone use some <? php ?> inside that submit section. I have all my list items with a class of dblclick so that I can edit them and update my db. It isn't working right now but ideally I want to know if I can use submit: $content

I want the php script (save.php) to handle updating the DB but right now my entire save.php looks like this

  1. <?php

  2. $mysqli=new mysqli('localhost','user','pass','db');
  3. if (mysqli_connect_errno()) 
  4. {
  5.     printf("Connect failed: %s ", mysqli_connect_error());
  6.     exit();
  7. }
  8. $content=$_POST['content'];
  9. $itemID=$_POST['itemID'];
  10. $statement= $mysqli->prepare("UPDATE `Items` SET `content`= ".$content." WHERE itemID = ".$itemID." ");
  11. $statement->bind_param("si",$content, $itemID);
  12. $statement->execute();
  13. $statement->close();

  14. ?>

What would I need to alter in the jeditable dblclick class and my php file? Any help is REALLY appreciated.

For those familiar with jeditable the code for a class 'doubleclick' looks like this



  1. $(function() {
  2. $(".dblclick").editable("http://www.scottsteelerectors.com/save.php", { 
  3.       indicator : "<img src='img/indicator.gif'>",
  4.       tooltip   : "Double click to edit...",
  5.       event     : "dblclick",
  6.       style  : "inherit"
  7. });
  8. });