immunity Posted June 20, 2007 Share Posted June 20, 2007 Hello i try to pass greek words(f.ex Γιάννης ) from a input text of a form (in a html) via Javascript (document.form.sumbit()) i have as attitude of form acceptCharset="UTF-8"; if i type myself the greek words in variable at .php (not in html form) mysql update corrected if i type myself the greek words in .php?value1=...&value2=... and use $_GET['value1'] Mysql udate correct 1)when i try to pass with post there is the problem it appear me Ξ$*#Ξ%#Ξ$Ξ#Ξ$Ξ%Ξ while the word is "ογαμιαςογιαννης" (i put to echo the $sQuery that send to server and its wrong) 2) if i put in the .php header(...UTF-; While the sQuery printed on Browser CORRECTED , with my putty i see that Mysql Database updated INCORRECTED Anyone knows how i can send correct the UTF-8 values to the Mysql database? code of 1) and 2) //header('Content-type: text/html; charset=utf-8'); (these exist only in code of 2) ) $sInfo = ""; $sDBServer = "localhost"; $sDBName = "SSSSSS"; $sDBUsername = "SSSSSS"; $sDBPassword = "SSSSSS"; //create the SQL query string $sQuery = "Insert into account Values('$_POST[account]' ,'$_POST[password]','$_POST[email]','$_POST[location]','$_POST[name]','$_POST[lname]','$_POST[address]','$_POST[phone]',0)"; $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; if($sInfo == '') { if($oResult = mysql_query($sQuery) ) { $sInfo= "correct.html"; } else{ $sInfo="wrong.html"; } } $sQuery2= "Select * from account"; //make the database connection $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or $sInfo = "Unable to open database"; if($sInfo == '') { if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult) > 0) { $aValues = mysql_fetch_array($oResult,MYSQL_ASSOC); $sInfo = $aValues['name']."<br />".$aValues['address']."<br />". $aValues['e_mail']."<br />".$aValues['Password']."<br />". $aValues['location']."<br /><br />Phone: ".$aValues['account']."<br />"; } } mysql_close($oLink); echo $sInfo; echo $sQuery; ?> Link to comment https://forums.phpfreaks.com/topic/56461-cant-pass-utf-8-values-in-my-mysql-via-phppost-form/ Share on other sites More sharing options...
immunity Posted June 20, 2007 Author Share Posted June 20, 2007 for 2) code Explorer broswer (echoed sQuery) => Insert into account Values('δασδα' ,'α','[email protected]','ασδζχψ','ασδασδ','ασδασδ','ασδς;ε','2222222222',0) Mysql Database (with putty) => | Ξ±Οδ΢ΟΟ | Ξ± | [email protected] | Ξ±Οδ΢ΟΟ | Ξ±Οδαδ | Ξ±ΟΞ΄ | Ξ±ΟΡ΢ΟΟ | 2222222222 | 0 | Link to comment https://forums.phpfreaks.com/topic/56461-cant-pass-utf-8-values-in-my-mysql-via-phppost-form/#findComment-278876 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.