phpmady Posted May 31, 2010 Share Posted May 31, 2010 Hi, I am using the ajax to update the table, when i use windows-1256 charset i have no problem, and when i am using utf8, i have problem in arabic characters. thanks Link to comment https://forums.phpfreaks.com/topic/203437-desperate-need-of-help/ Share on other sites More sharing options...
phpmady Posted May 31, 2010 Author Share Posted May 31, 2010 Hi, I am using the ajax to update the table, when i use windows-1256 charset i have no problem, and when i am using utf8, i have problem in arabic characters. thanks when i get the value from the table, am getting ???? , hope you get me Thanks Link to comment https://forums.phpfreaks.com/topic/203437-desperate-need-of-help/#findComment-1065789 Share on other sites More sharing options...
phpmady Posted May 31, 2010 Author Share Posted May 31, 2010 this is the code am working on: <?php include "global.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> var xmlhttp; //function namechange(name_fieldvalue) function namechange(name_fieldvalue,name_fieldname,id_val,id_fieldname,table_name) { alert(name_fieldvalue); alert(name_fieldname); alert(id_val); alert(id_fieldname); alert(table_name); if (name_fieldvalue.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="ajax_namechange_dup.php"; url=url+"?name_fieldvalue="+name_fieldvalue; url=url+"&name_fieldname="+name_fieldname; url=url+"&id_val="+id_val; url=url+"&id_fieldname="+id_fieldname; url=url+"&table_name="+table_name; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } </script> </head> <?php $sql = "SELECT * FROM newssection where NewsSection_ID=1"; $temps = $DB_site->query($sql); while ($temp = $DB_site->fetch_array($temps)) { echo $temp['NewsSection_ID']; echo $temp['NewsSection_Name']; echo "<br>"; $val = $temp['NewsSection_Name']; } ?> <form name="act" action="testing.php" method="get"> <span class="view_col1"> <input type="text" onblur="namechange(this.value,'NewsSection_Name',1,'NewsSection_ID','newssection')" value="<?php echo $val; ?>"> </span> <div id="txtHint"></div> </form> updatefile: <?php include("global.php"); header('Content-type: text/html;charset=UTF-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $name_fieldvalue=$_GET["name_fieldvalue"]; $name_fieldname=$_GET["name_fieldname"]; $id_val = $_GET["id_val"]; $id_fieldname = $_GET["id_fieldname"]; $table_name = $_GET["table_name"]; echo $name_fieldvalue; $sq = "UPDATE $table_name SET $name_fieldname='".$name_fieldvalue."' WHERE $id_fieldname = '".$id_val."'"; echo $sq; $DB_site->query($sq); $response = $sq; //output the response echo $response; ?> </body> </html> thanks Link to comment https://forums.phpfreaks.com/topic/203437-desperate-need-of-help/#findComment-1065796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.