php - Unable to Update the Data using Inline Editing -
php - Unable to Update the Data using Inline Editing -
i'm working application in php need update contents has been added in db, not able update info using inline editing.
here sample code:
viewpage.php
function savelesson(id,pid,content) { alert(document.getelementbyid('content'+id).value); $("#edit"+id).show(); $("#save"+id).hide(); body=document.getelementbyid('content'+id).value; $.ajax({ type: "post", url: 'editpagehtml1.php', data: {id: id,pid : pid, text:body}, success: function(data) { window.location.reload(); }, error: function() { alert("error"); } });
editpagehtml1.php
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <body> <?php include('../chapter/path.php'); $phid=$_post['id']; $pageid=$_post['pid']; $text=$_post['text']; $dbh = new pdo($dir) or die("cannot open database"); $query = "update page_html set `page_id`='".$pageid."',`content`='".$text."',`language`='en' id=".$phid; $dbh->exec($query); ?> </body> </html>
save button code:
<td id="savelnum<?php echo $row[0]; ?>" ><a href="#" id='save<?php echo $row[0]; ?>' onclick="savelesson('<?php echo $row[0]; ?>','<?php echo $row[0]; ?>','<?php echo $row[0]; ?>');">save</a></td>
php inline-editing
Comments
Post a Comment