i have a inline editing on table. if the table contains special chars and symbols ajax cannot post it properly
TABLE.PHP
<script>
function showEdit(editableObj) {
$(editableObj).css("background","#FFF");
}
function saveToDatabase(editableObj,column,id) {
$(editableObj).css("background","#FFF url(loaderIcon.gif) no-repeat right");
$.ajax({
url: "saveedit.php",
type: "POST",
data:'column='+column+'&editval='+editableObj.innerHTML+'&id='+id,
success: function(data){
$(editableObj).css("background","#FDFDFD");
}
});
}
</script>
<td style="vertical-align:top" contenteditable="true" onBlur="saveToDatabase(this,'PNAME','<?php echo $faq[$k]["ID"]; ?>')" onClick="showEdit(this);"><?php echo $faq[$k]["MSG"]; ?></td>
SAVEEDIT.PHP
<?php
require_once("DBcontroller.php");
$db_handle = new DBController();
$editval = mysql_real_escape_string($_POST["editval"]);
$result = mysql_query("UPDATE ARTICLE SET " . $_POST["column"] . " = '$editval' WHERE ID=".$_POST["id"]);?>
I WANT POST "Spine Tenderness ↓+, LS & Rt.Gluteal regions, Muscle spasm ↓+, ROM pain ↓ & improved" THIS CONTENT IN TABLE TO SAVEEDIT.PHP AND UPDATE IT IN DATABASE
Follow these steps if you want to store spacial char in database table.
step1: change your table's Collation- utf8_unicode_ci
step2: Also change fields Collation - utf8_unicode_ci
Step3: Go to the your db config file
Step4: After connecting to the database put following code.
mysql_query("SET NAMES utf8"); // or
mysql_query("utf8");
That's all. Hope it will help