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
- <?php
- $mysqli=new mysqli('localhost','user','pass','db');
- if (mysqli_connect_errno())
- {
- printf("Connect failed: %s ", mysqli_connect_error());
- exit();
- }
- $content=$_POST['content'];
- $itemID=$_POST['itemID'];
- $statement= $mysqli->prepare("UPDATE `Items` SET `content`= ".$content." WHERE itemID = ".$itemID." ");
- $statement->bind_param("si",$content, $itemID);
- $statement->execute();
- $statement->close();
- ?>
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
- $(function() {
- $(".dblclick").editable("http://www.scottsteelerectors.com/save.php", {
- indicator : "<img src='img/indicator.gif'>",
- tooltip : "Double click to edit...",
- event : "dblclick",
- style : "inherit"
- });
- });