i'm a newbie to this community. Seeking your help in doing Mika Tuupola's jEditable. I just want to save the data into the database and show the changes on the page. Below is my code -
<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>
And here is the php code for inserting to database -
<?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);
?>
I'm not able to save it to database. I'm getting an error which says "Undefined index: id in C:\wamp.." and "Undefined index: content in C:\wamp.." Both the "id" and "content" it says as undefined. Please help.