0
我是這個社區的新手。在Mika Tuupola的jEditable尋求你的幫助。 我只想將數據保存到數據庫中並顯示頁面上的更改。下面是我的代碼 -jEditable - 保存到數據庫
<head>
<script src="js/jquery-1.7.1.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.jeditable.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#editab").editable("insert.php", {
id : 1,
content : 'editab',
indicator : "<img src='img/indicator.gif'>",
tooltip : "Doubleclick to edit...",
event : "click",
height : 'auto',
onblur : 'submit',
});
});
</script>
</head>
<body>
<div style="width:640px" class="editable" id="editab">sdfsdf</div>
</body>
</html>
,這裏是插入到數據庫中的PHP代碼 -
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$id = $_POST['id'];
$content = $_POST['content'];
mysql_query("INSERT INTO editable (id, content)
VALUES ('$id', '$content')");
echo $content;
mysql_close($con);
?>
我不能將它保存到數據庫中。我收到一個錯誤,裏面寫着「未定義的索引:ID在C:\ wamp ..」和「未定義的索引:C:\ wamp中的內容..」。 它表示未定義的「id」和「content」。請幫忙。